indexOf() (1) 썸네일형 리스트형 배열 메서드[indexOf(), includes()] arr.indexOf() 배열의 요소(index)가 있는지? 있다면 몇번째에 존재하는지 알려주는 메서드. let words = [’Radagast’, ‘the’, ‘Brown’]; words.indexOf('the') // 1 words.indexOf('Radagast') // 0 words.indexOf('없는단어') // -1 해당 배열에 index가 있다면? 0 { let isPresent = arr.indexOf(ele) !== -1; return isPresent; } // isPresent === arr에 ele요소가 -1과 같지 않다면(존재 한다면) hasPresent(words, "없는.. 이전 1 다음