document.querySelectorAll('span.overallAmount')[0].textContent = '100 000';
const boxes = document.querySelectorAll('.box');
boxes.forEach((box, index) => box.addEventListener('click', function(e) {
console.log(index + 1);
this.style.backgroundColor = 'red';
}));
const consoleLogs = [];
console.customLog = console.log.bind(console);
console.log = function(...args) {
console.customLog(...consoleLogs[consoleLogs.length] = args);
}
console.log('toster');
consoleLogs //[['toster']]
const val = document.querySelector('input').value.trim().toLowerCase().split(/\s+/);
const res = arr.filter(o => val.some(s => o.firstName.toLowerCase().includes(s) || o.lastName.toLowerCase().includes(s)));
class Example {
constructor() {
this.date = Date.now();
}
}
const o = new Example;
o.date //1548185841559 Unix time(миллисекунды)
const obj = {date: Date.now()};
const results = year.map(inner =>
years.reduce((a, c) => a.concat(c.filter((v, i) => v == inner[i]).length > 1 ? [c] : []), []));
const o = {};
function copy(t, ...r) {
for (k in r) t[k] = r[k];
}
copy(o, {name: 'John'}, {n: 42});
o //0: {name: "John"} 1: {n: 42}
Object.assign();
const arr = [];
const obj = {name: 'John', surname: 'Doe'};
if (arr.every(o => o.name != obj.name || o.surname != obj.surname)) arr.push(obj);
[].every(v => v); // true
const blocks = document.querySelectorAll('.block-works-item');
blocks.forEach(block => {
block.addEventListener('mouseenter', function() {
this.querySelector('.text-block_price').classList.add('text-block_price_hover');
});
block.addEventListener('mouseleave', function() {
this.querySelector('.text-block_price').classList.remove('text-block_price_hover');
});
});