I have different kind of javascript objects, they all have a property 'row'.
var row1 = {
row: 1
};
var row2 = {
row: 2
};
var row3 = {
row: 3
};
var row4 = {
row: 4
};
...
I have an array defined as follow:
var objArray = [];
In this array it's possible to have multiple 'rows'. The sequence is always te same starting from the lower row to a higher row.
Now I want to get the objects that are linked next to each other (like 4 in a row). In my case it's also possible to have 3 in a row, 5 in a row and so on..
Example:
objArray.push(row0);
objArray.push(row1);
objArray.push(row2);
objArray.push(row3);
objArray.push(row5);
objArray.push(row6);
objArray.push(row7);
objArray.push(row9);
objArray.push(row10);
objArray.push(row12);
In this case I need 2 lists, 1 containing row0 to 3 and one containing 5 to 7.
I've tried a bit in this JSFiddle: Here we can see the console output If you need more clarification, please ask.
Thanks in advance!
0-3,5-7,9-10and12? no?