Created
March 16, 2016 14:48
-
-
Save csdear/d0ceb3b9c004fb7fc7d9 to your computer and use it in GitHub Desktop.
Simple Array IndexOf
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 fruits = ['banana', 'orange', 'apple', 'mango']; | |
| var wheresTheApple = fruits.indexOf("apple"); | |
| >wheresTheApple | |
| <2 | |
| //This is case sensitive. if not found retuns -1 | |
| var wheresTheApple = fruits.indexOf("Apple"); | |
| undefined | |
| wheresTheApple | |
| -1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment