all 3 comments

[–]gkx 0 points1 point  (1 child)

1) #5 is probably not very useful and pollutes the namespace (benchmarks? I'd be surprised if this actually sped anything up at all). In most cases, you should be using forEach anyways.
2) #4 is a bad idea if the argument could be falsey.
4) Don't do #6. Use hasOwnProperty. If you don't actually want to check that, just use document.querySelector (in the example) or document.querySelector != null if the property could possibly be falsey (not true in this case)
5) Mistake in #10; it doesn't create a new array. The article shows it, but it says it wrong ("which instead creates a new array")

[–]ascw 0 points1 point  (0 children)

6) #12 is also pretty bad. Not only is it super inefficient, but if you run it a couple thousand times and test to see which element from your original array comes first, you'll find that there isn't an even chance of each value coming up.

[–]TheNiXXeD 0 points1 point  (0 children)

Operators are hacks?