I have the following two arrays:
var arr1 = [1,2,4,5];
var arr2 = [];
How would I go about to split it when there is no consecutive value?
In this example, it should be split into: [
[1,2]
and [4,5]
.
These two arrays should be stored in arr2.
Example 2 :
var arr3 = [1,2,3,5,6,7,8,9,10,11,13]
Result : [[1,2,3], [5,6,7,8,9,10], [11], [13]]