Javascript examples for Array Operation:Array Nest
Using splice with nested arrays in Javascript
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w ww. j a v a 2s . com mainArray = new Array(new Array(1)); arraysToAdd = new Array(new Array(1,2), new Array(1,4), new Array(1,7), new Array(1,8)); console.log(arraysToAdd.length); mainArray.splice.apply(mainArray, [0,1].concat(arraysToAdd)); console.log(mainArray.length); } </script> </head> <body> </body> </html>