result => alert(result)alertconst func = result => alert(result);
let promise = new Promise(resolve => resolve('Done!')).then(func) //Выполнится func
const values = [ id, sum, system, date ];.payment.innerHTML = values.map(n => `<td>${n}</td>`).join('');
// или
values.forEach(n => payment.insertCell().textContent = n);
// или
payment.append(...values.map(n => {
const td = document.createElement('td');
td.innerText = n;
return td;
}));- function createPayment({id, sum, system, date}) {
+ function createPayment(data) {- const values = [ id, sum, system, date ];
+ const keys = [ 'id', 'sum', 'system', 'date' ];- values.forEach(n => payment.insertCell().textContent = n);
+ keys.forEach(n => payment.insertCell().textContent = data[n]);
const newArr = Array
.from(arr.reduce((acc, n) => acc.set(n, (acc.get(n) ?? 0) + 1), new Map))
.filter(n => n[1] === 1)
.map(n => n[0]);arr.splice(0, arr.length, ...Array
.from(arr.reduce((acc, n) => acc.set(n, acc.has(n)), new Map))
.reduce((acc, n) => (n[1] || acc.push(n[0]), acc), [])
);
if (a > b) console.log("a win");
if (a > b) {
console.log("b lost");
console.log("a won");
}То же с for (), да и с просто-кодом.class или литералом объекта.function, а затем про круглые скобки )
В JavaScript есть только один стек вызовов, так как это однопоточный язык.
Object.keys(a).forEach(k => b.hasOwnProperty(k) && (a[k] = b[k]));for (const [ k, v ] of Object.entries(b)) {
if (a.hasOwnProperty(k)) {
a[k] = v;
}
}


Желательно такое объяснение, чтобы прямо для самого глупого человека на планете оно было.