JAVASCRIPT
The .findIndex() Method
Made Project
2020. 6. 23. 16:16
const animals = ['hippo', 'tiger', 'lion', 'seal', 'cheetah', 'monkey', 'salamander', 'elephant'];
const foundAnimal = animals.findIndex(animal => {
return animal === 'elephant';
});
const startsWithS = animals.findIndex(animal => {
return animal[0] === 's' ? true : false;
});