Javascript examples for Array:splice
At position 2, remove 2 items:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> var fruits = ["a","b","c","d","e", "Kiwi"]; document.getElementById("demo").innerHTML = fruits; function myFunction() {//from w ww . j ava 2 s . c o m fruits.splice(2, 2); document.getElementById("demo").innerHTML = fruits; } </script> </body> </html>