Using the splice() method to replace elements : Splice : Array JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Array » Splice »

 

Using the splice() method to replace elements

















<html>
<head>
<title>Using the splice() method to replace elements</title>
<script type="text/javascript" language="javascript">
<!-- //
function SpliceArray(){
    var x = new Array("a","b""c""d");
    var xj = x.join(", ");
    document.write("<P>The original array x contains: " + xj + " </p>");
    document.write("<P>The length of the original array x is: " + x.length + " </p>");
    x.splice(12"B""C");
    var xj = x.join(", ");
    document.write("<P>The original array x now contains: " + xj + " </p>");
    document.write("<P>The length of the original array x is now: " + x.length + " </p>");
}
// -->
</script>
</head>
<body onload="SpliceArray()">

</body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Array
» Splice