원하는 인덱스 찾기(indexOf, lastIndexOf, findIndex)
1. 개요
2. Array.indexOf()
arr.indexOf(searchElement[, fromIndex])
const color = ["black", "red", "blue", "green", "blue"];
const index1 = color.indexOf("red");
const index2 = color.indexOf("blue");
const index3 = color.indexOf("blue", 3);
const index4 = color.indexOf("yellow");

3. Array.lastIndexOf()

4. Array.findIndex()

5. Conclusion
참고
Previous배열의 요소 추가 삭제(push, pop, unshift, shift, splice, slice)Next배열의 요소를 순회하기(forEach, map, some, every)
Last updated