Reputation: 131
I don't understand the point of having the second parameter in the splice method.
var example = [ 'one', 'two', 'three' ]
example.splice(0,1)
Looking at articles and it says the second parameter determines how many item get removed. But it seems to me that there is always only one item in a single position.
What is the point of indicating how many items you want to delete when there will only be one item in a single position?Can you have multiple items in a single indice/index?
Upvotes: 0
Views: 1438
Reputation: 368
array.splice(start, deleteCount)
The documentation says that the second paramter determines how many elements you want to delete. So you might use it to delete 2 or more entries from an array with this at a specific position.
Upvotes: 1