Given an array that you are going to test membership against, for example if you are creating a set:
var arr = [‘some stuff’];
arr.indexOf(‘not here’) > -1
which is a bit more compact, and possibly more readable once I get used to it.
Out of curiosity, I created a benchmark to compare the two, which is ridiculous since they are both so fast.
However, the interesting thing is V8’s performance with a second pass: http://jsperf.com/using-for-indexof-vs-1
Firefox gives results that I would have expected.