How to write a script manage a list using JavaScript?

Q

How to write a script manage a list using JavaScript?

✍: Guest

A

1. To remove an item from a list: set it to null:
myList[3] = null;
2. To truncate a list: reset the length property:
myList.length = 2;
3. To delete all items in a list, set the length to 0:
myList.length = 0;

2008-07-01, 5176👍, 0💬