Skip to content

Instantly share code, notes, and snippets.

@paulodutra
Created June 28, 2021 17:22
Show Gist options
  • Save paulodutra/f8b09a46f69df42544a7cd18d5a39d31 to your computer and use it in GitHub Desktop.
Save paulodutra/f8b09a46f69df42544a7cd18d5a39d31 to your computer and use it in GitHub Desktop.
Antes da ES7, para verificar se um determinado elemento se encontra em um array, era utilizado o indexOf e caso o mesmo não existisse o valor retornado é igual a -1.
const arr = [1, 2, 3];
console.log(arr.indexOf(3) > - 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment