
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;
});
'JAVASCRIPT' 카테고리의 다른 글
| forEach() 예문 (0) | 2020.06.24 |
|---|---|
| The .reduce() Method (0) | 2020.06.23 |
| The .filter() Method (0) | 2020.06.23 |
| The .forEach() Method (0) | 2020.06.14 |
| 중첩 for 문 예시 (0) | 2020.06.09 |