Skip to content

Instantly share code, notes, and snippets.

@PandiyanCool
Created October 17, 2017 16:03
Embed
What would you like to do?
// 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