I need to start from second item in array. In order to save correct context I need to use forEach
instead of simple for
loop.
I've done it in next way :
private convertToRanges(arr: []): any[] {
const inputArr = arr.slice(),
if (inputArr.length > 1) {
let lastIndex = 0;
inputArr.shift();
inputArr.forEach(item => {
...
});
}
...
}
I make copy and remove first item in copy.
Is there another way to start from second item and be context sure?