var a, b, c;
a = 1; // a = 1, b = undefined, c = undefined
b = a++; // a = 2, b = 1, c = undefined
c = ++a; // a = 3, b = 1, c = 3
alert(b + c); // 1 + 3
shortest = input[0].length
shortest = Infinity
if (input[i].length < longest )
else if
let delay = (func, ms) => {
return function() {
setTimeout(func, ms, ...arguments);
}
}
...
let f1000 = delay(obj.func.bind(obj), 1000);
#spinner:before {
border-top-color: #e1472f;
border-left-color: #e1472f;
border-right-color: #e1472f;
}
$('.section').html(html);
выполняется до того, как получен ответ от сервера. Этот ответ, соответственно, просто игнорируется. Как решить проблему я вам написал в прошлом вопросе. navigator.geolocation.getCurrentPosition()
является асинхронным. Это значит, что в момент заполнения html значения ещё могут быть не получены. Должно быть так:$(document).ready(function() {
setLocation();
});
function setLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$('.section').html('<p>Latitude: ' + position.coords.latitude; + '</p><br><p>Longitude: ' + position.coords.longitude + '</p>');
});
};
}
const maxId = arr.reduce((max, item) => item.id > max ? item.id : max, 0);
document.getElementsByClassName('rez')[0].innerHTML += rez;
document.getElementsByClassName('rez')[0].innerHTML = '';
document.querySelector('.rez').innerHTML = '';
getElementsByClassName
возвращает коллекцию элементов, а вы пытаетесь работать с ней как с единственным элементом. document.querySelector('.woof_select_product_cat')
спасёт отца русской демократии. function myHash(list) {
var result = {};
for (var i = 0; i < list.length; i++) {
result[list[i][0]] = list[i][1];
}
return result;
}
console.log(myHash([['foo', 'bar'], ['baz', 42], [true, false]]));
var list = [['foo', 'bar'], ['baz', 42], [true, false]];
var result = list.reduce(function (obj, item) {
obj[item[0]] = item[1];
return obj;
}, {});
console.log(result);