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;
}))
echo preg_replace('/(\s[А-ЯЁ])[а-яё]+/u','$1.','Фамилия Имя Отчество');
(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); }