.addEventListener("click", player.prevAudio)
const brandsPredicate = s.hasOwnProperty("brands") && s.brands.length > 0
? product => s.brands.includes(product.brand_id)
: () => true;
const paramsPredicate = s.hasOwnProperty("params") && s.params.length > 0
? product => product.hasOwnProperty("params") &&
s.params.some(param => product.params.includes(param))
: () => true;
const result = products.filter(product => brandsPredicate(product) && paramsPredicate(product));
function calculateUTCOffsetSeconds(timestamp) {
const date = new Date(timestamp);
const utcTime = date.getUTCHours() * 3600 +
date.getUTCMinutes() * 60 +
date.getUTCSeconds();
const localTime = date.getHours() * 3600 +
date.getMinutes() * 60 +
date.getSeconds();
return localTime - utcTime;
}
console.log(calculateUTCOffsetSeconds(-2208988800000));
const freqUpdateInMs = 1000
export default {
data() {
return {
loading: false,
items: {},
timer: null
}
},
mounted() {
const fetchData = () => {
this.$store.commit('setLoading', true)
this.fetchData()
.finally(() => {
this.timer = setTimeout(fetchData, freqUpdateInMs)
this.$store.commit('setLoading', false)
})
}
fetchData()
},
beforeDestroy() {
clearTimeout(this.timer)
}
}
box.addEventListener('mousemove', move, { once: true });
https://developer.mozilla.org/en-US/docs/Web/API/E... eval("/name=" + lastResFind + "/gi")
https://developer.mozilla.org/en-US/docs/Web/JavaS... str.replace(/\s+/g, ' ').trim();
return str.replace(/\s+/g, ' ').trim();
// Сохраняем исходные индексы и сортируем по высоте по убыванию
const preparedData = data
.map((e, i) => ({i, e}))
.sort((a, b) => b.e.height - a.e.height);
for (const el of preparedData) {
const { height } = el.e;
// тут никогда не вернет -1, так как мы ищем элемент который точно есть в массиве - минимальный
const index = columnHeight.indexOf(Math.min(...columnHeight));
// обновляем данные массивов по выбранному индексу
columnHeight[index] += height;
columns[index].push(el);
}
// нормализуем columns
for (let i = 0; i < columns.length; ++i) {
// восстановим исходный порядок, отсортировав по сохраненному индексу по возрастанию
columns[i].sort((a, b) => a.i - b.i);
// избавимся от сохраненных индексов, оставив только исходные объекты
columns[i] = columns[i].map(({ e }) => e);
}
navigator.mediaDevices.getUserMedia({video: true})
function fromPrototype(proto) {
function F() {}
F.protoype = proto;
return F;
}
const obj = {
_sayHi() {
console.log(`Hello, my name is ${this.name}!`);
},
};
class Person extends fromPrototype(obj) {
constructor(name, age) {
this.name = name;
this.age = age;
if (this.age < 0 ) {
this.age = 0;
}
}
}