Created
June 28, 2021 17:24
-
-
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.
This file contains hidden or 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
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