Last active
January 3, 2017 15:22
-
-
Save nosalvage/780e5dd1406520ee3db1026ea3e9417b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var positions = [ | |
{ | |
id: 0 | |
}, | |
{ | |
id: 60 | |
}, | |
{ | |
id: 120 | |
} | |
]; | |
var all_tr = []; //тут типа все трки | |
var new_data = []; //разбитые данные | |
for(var i = 0; i < positions.length ; i++){ | |
if(i == positions.length){ | |
for(var j = positions[i].id; j < all_tr.length; j++){ | |
new_data[i].push(all_tr[j]); //добавить обьект в конец | |
} | |
}else{ | |
for(var j = positions[i].id; j < positions[i++].id; j++){ | |
new_data[i].push(all_tr[j]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment