- 
      
- 
        Save rowild/3b0705e29a04e026a7a9cba236389237 to your computer and use it in GitHub Desktop. 
    better contains
  
        
  
    
      This file contains hidden or 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