Skip to content

Instantly share code, notes, and snippets.

@paulodutra
Created June 28, 2021 17:24
Show Gist options
  • Save paulodutra/bdc4495cc2f3e18b5abf6c1686b006b8 to your computer and use it in GitHub Desktop.
Save paulodutra/bdc4495cc2f3e18b5abf6c1686b006b8 to your computer and use it in GitHub Desktop.
Com a feature array.includes adicionada na ES7, basta informar o valor diretamente a chamada da função e a mesma retonará true caso o elemento exista no array e false para caso não exista.
const arr = [1, 2, 3];
console.log(arr.includes(3)); //retornará true
console.log(arr.includes(5)); //retornará false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment