Created
June 28, 2021 17:22
-
-
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.
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.indexOf(3) > - 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment