Insert an array in another array

by Subramanian 2012-09-14 12:24:16

var a = [1,2,3,7,8,9]

var b = [4,5,6]
var insertIndex = 3;

a.splice.apply(a, Array.concat(insertIndex, 0, b));
Print(a); // prints: 1,2,3,4,5,6,7,8,9
842
like
0
dislike
0
mail
flag

You must LOGIN to add comments