Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var popup = "something..."
- var popups = [];
- // Add with .push()
- popups.push("something");
- popups.push("something else");
- // Remove with .splice()
- // to remove the first element popups[0]
- popups.splice(0, 1);
- popups.push("third thing");
- popups.push("fourth thing");
- console.log(popups);
- // ["something else", "third thing", "fourth thing"]
- // Remove the current second item popups[1]
- popups.splice(1,1);
- console.log(popups);
- // ["something else", "fourth thing"]
- for (var i=0; i<popups.length; i++) {
- if (popups[i] === valueToRemove) {
- popups.splice(i, 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment