What's an easy way of storing an array of numbers in Javascript that I can add/remove from?
- by SLC
In C# I would create a List then I could add and remove numbers very easily. Does identical functionality exist in Javascript, or do I have to write my own methods to search and remove items using a loop?
var NumberList = [];
NumberList.Add(17);
NumberList.Add(25);
NumberList.Remove(17);
etc.
I know I can use .push to add a number, so I guess it's really how to remove an individual number without using a loop that I'm looking for.
edit: of course, if there's no other way then I'll use a loop!:)