A (Com web hosting) Array.splice() (Method) Example code: // Create

A Array.splice() (Method) Example code: // Create an array and test the Array.splice() method myArray = new Array(”AAA”, “BBB”, “CCC”, “DDD”, “EEE”); document.write(”Array
“) displayArrayAsTable(myArray); document.write(”Array.splice() result
“) displayArrayAsTable(myArray.splice(3, 1, “XXX”, “YYY”, “ZZZ”)); document.write(”Array after splice
“) displayArrayAsTable(myArray); // Display an array in a table function displayArrayAsTable(anArray) { myLength = anArray.length; document.write(”

“); for(myIndex = 0; myIndex < myLength; myIndex++) { document.write("“); } document.write(”
“); document.write(myIndex); document.write(”“); document.write(anArray[myIndex]); document.write(”


“) } See also: Array.prototype Cross-references: ECMA 262 edition 3 section 15.4.4.12

Leave a Reply