Mega Code Archive

 
Categories / JavaScript Tutorial / Array
 

Using the splice() method to insert elements

< html> <head> <title>Using the splice() method to insert elements</title> <script type="text/javascript" language="javascript"> <!-- // function SpliceArray(){     var x = new Array("a","d", "e", "f");     var xj = x.join(", ");     alert(xj);     alert(x.length);     x.splice(1, 0, "b", "c");     var xj = x.join(", ");     alert(xj);     alert(x.length); } // --> </script> </head> <body onload="SpliceArray()"> </body> </html>