learnJS

>>> "Find and remove an element from an array."
"Find and remove an element from an array."
>>> arr = ["one", "two", "three", "four", "five", "six"]
["one", "two", "three", "four", "five", "six"]
>>> pos = arr.indexOf("nine")
-1
>>> ":-("
":-("
>>> pos = arr.indexOf("three") // :)
2
>>> if (pos!=-1) arr.splice(pos, 1)
["three"]
>>> arr
["one", "two", "four", "five", "six"]

j vimeo.com/14790806

Loading more stuff…

Hmm…it looks like things are taking a while to load. Try again?

Loading videos…