Created
May 4, 2011 22:28
-
-
Save fat/956180 to your computer and use it in GitHub Desktop.
better contains
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ALEX = ['foo', 'bar']; | |
//n00bs write: | |
if (ALEX.indexOf('foo') > -1) { | |
//ALEX contains foo | |
} | |
//pros write: | |
if (~ALEX.indexOf('foo')) { | |
//ALEX contains foo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment