Hello
Could someone help me? My console.log(start with) shows only ‘3’ but there is another word ‘salamander’ in 6, the printing should be 3 and 6. Why it is printing only 3?
thanks
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;
}
)
console.log(startsWithS);
console.log(foundAnimal);