Skip to content

Instantly share code, notes, and snippets.

@OlivierJM
Last active August 1, 2018 21:14
Show Gist options
  • Save OlivierJM/7c26d2d05dac54f7f92402c6968ee636 to your computer and use it in GitHub Desktop.
Save OlivierJM/7c26d2d05dac54f7f92402c6968ee636 to your computer and use it in GitHub Desktop.
const items = [1, 2, 3, 4, 5 ];
if(items.includes(5)){
console.log(true) // true
}
if(items.indexOf(5) > -1){
console.log(true); // true ;
}
console.log(items.indexOf(6) >= -1) // true
console.log(items.includes(6)) // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment