pav
6/3/2013 - 8:02 PM

The splice method takes 2 arguments: the index position to start at, and the number of items to remove. So if you want to remove the first

The splice method takes 2 arguments: the index position to start at, and the number of items to remove.

So if you want to remove the first item from an array, you would type: myArray.splice(0,1)

//Here's our suits array
var suits = ["hearts","clubs","diamonds","spades"];

//remove the middle 2 items, "clubs" and "diamonds" from the array
suits.splice(1,2);