timeout = setTimeout(hovered = false,300);
как мне получить такой результатУвеличить все ключи на единицу. Если в ассоциативном массиве есть ключ 0, этот массив конвертируется в json именно как массив, а не как объект.
$a = [31, 5, 6, 4];
for ($index = count($a); $index > 0; $index--) {
$a[$index] = $a[$index - 1];
unset($a[$index - 1]);
}
ksort($a);
let chain = Promise.resolve();
for (let i = 0; i < 10; i++) {
chain = chain.then(myAsyncFunction);
}
chain.then(() => {console.log('all done')});
89 долларов за год за установку на 1 устройствоА где вы нашли информацию про одно устройство? До перехода на Toolbox лицензия прекрасно работала на нескольких компьютерах. Единственное ограничение - на одновременный параллельный запуск. Уверен, что и сейчас ничего не поменялось.
var MyWebSocket = function(url) {
this.url = url;
this.connection = this.connect(); // 2
Object.defineProperty(this, 'onopen', { // 4
set: function(cb) {
this.connection.then(cb.bind(this)); // 5
}
});
}
MyWebSocket.prototype.connect = function() {
console.log('connecting to %s', this.url);
return new Promise(function(resolve, reject) { // 3
setTimeout(resolve, 2000); // 6
});
}
var socket = new MyWebSocket('example.com:8081'); // 1
socket.onopen = function() {
console.log('connection to %s established', this.url); // 7
}
// Определения функций
function tmp (num) {
var prime = num != 1;
for (var i = 2; i < num; i++) {
if (num % i == 0) {
prime = false;
break;
}
}
console.log('0isPrime');
return prime;
}
tmp.memoized = function(key) {
console.log('memoized');
this._values = this._values || {};
return this._values[key] !== undefined ?
this._values[key] :
this._values[key] = this.apply(null, arguments);
};
tmp.memoize = function() {
console.log('memoize');
var fn = this;
return function() {
return fn.memoized.apply(fn, arguments);
};
};
// Определения переменных
var isPrime, isSeventeenPrime;
// Непосредственно код
console.log('0');
console.log('1');
console.log('2');
isPrime = tmp.memoize(); // console.log('memoize')
console.log('3');
isSeventeenPrime = isPrime(17); // console.log('memoized'), console.log('0isPrime')
console.log(isSeventeenPrime); // console.log(true)
console.log('4');