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
// ES 7 | |
var fruits = ['mango', 'jack fruit', 'banana' ] | |
fruits.includes('mango') // true | |
fruits.includes('orange') // false | |
// Earlier | |
var fruits = ['mango', 'jack fruit', 'banana' ] | |
fruits.indexOf('banana') // returns 2 - index of the array | |
fruits.indexOf('orange') // return -1 means value is not available in array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment