Re:JS1k demo: “Highway at Night”
by tracker1 on Sunday November 23, 2014 @09:24PM
(#8650763)
A perfect example of why "~x.indexOf(y)" may actually be better... you just messed up, as the alternative should be "x.indexOf(y) !== -1" or "x.indexOf(y) >= 0" or "x.indexOf(y)+1" ...
In any case, it's all a matter of style... because if you don't know that indexOf will return 0 for a positive match, you will still mess up.
In any case, it's all a matter of style... because if you don't know that indexOf will return 0 for a positive match, you will still mess up.