Use the splice() method to remove "HTML" and "CSS" from myArray. - Javascript Array

Javascript examples for Array:Quiz

Introduction

splice() method takes 2 parameters: the index position to start at, and the number of elements to remove.

Remember that array indexes start with 0.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
var myArray = ["Javascript", "HTML", "CSS", "SVG"];
myArray.splice(1, 2);//from w w w .j  a  v  a 2 s. c  o m
document.getElementById("demo").innerHTML = myArray;
</script>

</body>
</html>

Related Tutorials