Skip to content

Instantly share code, notes, and snippets.

@cranic
Created October 19, 2013 20:56
Show Gist options
  • Select an option

  • Save cranic/7061431 to your computer and use it in GitHub Desktop.

Select an option

Save cranic/7061431 to your computer and use it in GitHub Desktop.
[1, 2, 3, 4, 5, 6, 7].indexOf(5)
// 4
[1, 2, 3, 4, 5, 6, 7].indexOf(1)
// 0
[1, 2, 3, 4, 5, 6, 7].indexOf("a")
// -1
[1, 2, 3, 4, 5, 6, 7].indexOf(1.2)
// -1
if([1, 2, 3, 4, 5, 6, 7].indexOf("a") === -1)
console.log('O valor digitado está errado....');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment