References
Array.indexOf()
Leírás
Visszatér az Array példány első azon elemének indexével, amelynek értéke megegyezik a metódus argumentumába írt paraméter értékével.
Szintaxis
indexOf(searchElement)
indexOf(searchElement, fromIndex)Példa
const beasts = ['ant', 'bison', 'camel', 'duck', 'bison']
console.log(beasts.indexOf('bison'))
// Expected output: 1
console.log(beasts.indexOf('giraffe'))
// Expected output: -1
// Start from index 2
console.log(beasts.indexOf('bison', 2))
// Expected output: 4