Hi there,
Is there any function for Array such as insert(). Basicaly, I have an array and I need to be able to insert something at a specific index.
| SitePoint Sponsor |
Hi there,
Is there any function for Array such as insert(). Basicaly, I have an array and I need to be able to insert something at a specific index.

use the splice() method
mozilla js reference
Extracted from there:Code:myFish = ["angel", "clown", "mandarin", "surgeon"]; myFish.splice(2, 0, "drum"); myFish is now ["angel", "clown", "drum", "mandarin", "surgeon"]
Bookmarks