const animals = ['hippo', 'tiger', 'lion', 'seal', 'cheetah', 'monkey', 'salamander', 'elephant']; const foundAnimal = animals.findIndex(animals => { return animals ==='elephant'; }); console.log(foundAnimal); const startsWithS = animals.findIndex(animals => { return animals[0] ==='s'; }); console.log(startsWithS);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter