Хотел узнать, для браузерного фронта( для SPA приложения на Vue3), принято ли будет создавать обьекты через классы?
class MyClass {
Насколько в этих классах фичи поддерживаемые в браузерах, или полифиллами.
p.s. без typescript
Можно ли как то сделать чтобы по нажатию на кнопку повышалась громкость системы?
Нужен ли javascript для WEB пентестера?
Нужно ли WEB пентестеру знать еще и WEB? Я имею ввиду те знания, которыми обладает стандартный WEB разработчик (помимо языков программирования).
let response;
async function fetchData(request) {
try {
response = await Promise.race([
fetch(request),
new Promise((_, reject) => setTimeout(
() => reject(new Error('Timeout')), 500, // 0.5 секунды
)),
]);
}
catch (e) {
// Ошибка с таймаутом
if (e.message === 'Timeout' || e.message === 'Network request failed') {
console.log('Проблемы с интернетом!');
}
// Прочие ошибки
else {
throw e;
}
return;
}
try {
// Преобразуем результат запроса в json
console.log(await response.json());
}
catch (e) {
console.log('Ошибка при парсинге json');
}
}
const request = new Request('https://jsonplaceholder.typicode.com/todos/1', {
method: 'GET',
});
fetchData(request);
const array1 = [{
'id': 3231,
'stage': 3,
'sort': 999,
}];
const array2 = [{
'id': 3231,
'status_client': 3,
'status_date': '2024-11-22 16:18:58',
'sort': 999,
}];
const map = new Map(array2.map((item) => [item.id, item]));
const reduced = array1.reduce((acc, item) => {
const _item = map.get(item.id);
_item
? acc.push({..._item, ...item})
: acc.push(item);
return acc;
}, []);
console.log(reduced);
// [
// {
// id: 3231,
// status_client: 3,
// status_date: '2024-11-22 16:18:58',
// sort: 999,
// stage: 3
// }
// ]
Можно ли это реализовать?
Как выделить мышкой область на странице и присвоить класс элементам попавшим в эту область?
Может кто нибудь предложит решение на примере со скришота
Now that Babel 7.x is out, I'll just say that this should essentially be resolved. The only time you should see this, with Babel 7.x, is if you're doing one of:
You've actually using import and module.exports in the same file, which is not allowed by Webpack. You can sidestep this by setting "modules": "commonjs", which will make Babel compile the import to a require. This breaks tree shaking, as mentioned above though, so fixing your code would be a better idea.
You're using useBultins: 'entry'/'usage, or @babel/plugin-transform-runtime, and you are running Babel on CommonJS files (either your own, or in random node_modules, if you're trying to compile that). Babel assumes files are ES modules by default, meaning those transforms would insert import statements into your file, triggering case 1. above. You can avoid this issue by setting sourceType: "unambiguous" in your Babel configuration, which will tell it to guess the type, like Webpack does, instead of assuming all files are modules.
document.querySelector("#butlog").addEventListener('click', (e) => {
e.preventDefault(); // <---
window.location.assign("https://vk.com/");
});
или такую тему только с нуля писать?