Sunday, 29 September 2013

Merge Two Arrays in Javascript up to n values

Merge Two Arrays in Javascript up to n values

Preserve order
Merge block of values that overlap both at the end of the first array and
the beginning of the second, ie. (1,0,1,2)
both arrays can contain up to 50 values


var array1 = ["1","2","3","2","1","0","1","2"];
var array2 = ["1","0","1","2","4","1","2","3"];

No comments:

Post a Comment