Message0 => array [ {start - end}, ... ]
...
MessageN => array [ {start - end}, ... ]
async function run(start){
start = await new Promise(resolve => {
setTimeout(resolve,1000, start + 1);
});
start = await new Promise(resolve => {
setTimeout(resolve,1000, start + 1);
});
console.log(start);
}
run(1);
function enter(){
console.log('Навел');
}
var timeout = null;
$('#box').mouseenter(function(){
clearTimeout(timeout);
timeout = setTimeout(enter, 5000);
});
$('#box').mouseleave(function(){
clearTimeout(timeout);
});
function colSplit(arr, c){
var res = new Array(c);
for(var i=0;i<c;++i){
res[i] = [];
}
for(var i=0;i<arr.length;++i){
res[i%c].push(arr[i]);
}
return res;
}
var a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
console.log(colSplit(a, 3))
var data = [
{
"id": 111,
"name": "Петров",
"parentID": -1
},
{
"id": 222,
"name": "Алферов",
"parentID": 111
},
{
"id": 333,
"name": "Агапов",
"parentID": 222
},
{
"id": 8,
"name": "Грацкий",
"parentID": -1
},
{
"id": 2,
"name": "Иванов",
"parentID": 8
},
{
"id": 4,
"name": "Адаменко",
"parentID": 2
},
{
"id": 7,
"name": "Ларин",
"parentID": 4
}
]
console.log(data.filter(function(o, i, data){
return i+1 < data.length && o.id == data[i+1].parentID;
}))
(async function (){
const token = await client.pop('games:wait');
const {player1} = await client.hgetall('games:wait:' + token);
const accountInfo = await client.hgetall('account:' + player1);
})().catch(e){ console.error(e); }