getComputedStyle(element).getPropertyValue("border");
function each(arr, callback) {
arr.forEach(function (el, i) {
callback(el, i, arr);
}
}
function renderObj(e) {
e.preventDefault();
let str = '';
let inputKey = document.querySelector('.input-key').value;
let inputValue = document.querySelector('.input-val').value;
if (inputKey !== '' && inputValue !== '') {
obj[inputKey] = inputValue;
for (let key in obj) {
str += `Ключ: ${key}, Значение: ${obj[key]} <br>`
}
}
output.innerHTML = str;
document.querySelector('.input-key').value = '';
document.querySelector('.input-val').value = '';
}
$('#elem').click((() => {
// Основное тело функции будет исполнено один раз при установке обработчика
// Таким образом создастся замыкание для переменной count
let count = 0;
// А вот здесь уже вернётся настоящий обработчик клика,
// который будет вызваться при каждом нажатии
return () => {
count++;
console.log(count)
};
})());
$('#elem').click(() => {
let count = 0;
count++;
console.log(count);
});
"use strict";
let aa = [[2020,'01','01'],[2019,'01','01']];
console.log(aa[1][1]);
var a = [1,2,3,4];
var b = [3,4,5,6];
var с;
c = a;
Array.prototype.push.apply(a,b) // [1, 2, 3, 4, 3, 4, 5, 6]
c
тоже не очень понятно - массивы присваиваются по ссылке, поэтому a
изменится тоже.const collection = {
... и т.д.
}
const firestore = {
collection: (name) => return collecton,
}
const firebase = {
firestore: () => return firestore
};
при просмотре увидим, что он одинаков на всех этапах сортировок. В тоже время, он совпадает с последним отсортированным, массивом.
y < matrix.length
код matrix[y+1]
выйдет за границы массива. Длина массива всегда на единицу больше, чем его последний индекс*. Поэтому на последней итерации y равна последнему индексу, а y + 1 выходит за границы.matrix[y+1]
.