splice remove 0 elements before index and insert new element

Solutions on MaxInterview for splice remove 0 elements before index and insert new element by the best coders in the world

showing results for - "splice remove 0 elements before index and insert new element"
Sirine
27 Nov 2016
1let myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
2let removed = myFish.splice(2, 0, 'drum')
3
4// myFish is ["angel", "clown", "drum", "mandarin", "sturgeon"]
5// removed is [], no elements removed
6
similar questions