// это твой вопрос
var oReq = new XMLHttpRequest();
oReq.send();
function reqListener () {
......
json = JSON.parse(data); // <- это мой ответ
}
oReq.send(); // задаешь вопрос
alert(json); // и сразу пишешь мой ответ, пока я еще не ответил
чтобы был больший контроль над доступом к интернету (когда что-то идет не так у провайдера - приходится слишком долго ждать).
const result = ind.reduce((acc, col) => {
arr.forEach((n, i) => {
acc[i].push(i ? n.filter((m, j) => arr[0][j] === col) : col);
});
return acc;
}, arr.map(() => []));
const indObj = Object.fromEntries(ind.map((n, i) => [ n, i ]));
const result = arr.reduce((acc, n, i) => (
i && n.forEach((m, j) => acc[i][indObj[arr[0][j]]].push(m)),
acc
), arr.map((_, i) => ind.map(n => i ? [] : n)));
In software engineering, a software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design. It is not a finished design that can be transformed directly into source or machine code. It is a description or template for how to solve a problem that can be used in many different situations. Design patterns are formalized best practices that the programmer can use to solve common problems when designing an application or system.
console.log(a) //Cannot access 'a' before initialization
console.log(b) //undefined
const a = 2;
var b = 3;
var b;
console.log(b) //undefined
b = 3;
// shop.js
export function createShop(selector) {
document.querySelector(".createShop").addEventListener("click", e => {
// ...
});
}
// index.js
import { createShop } from "./shop.js";
createShop(".shop");