Editing
IntindexfindIndex(Functioncallback[ , ObjectthisArg])
findIndex()
는(은) Array.prototype.findIndex()
와(과) 동일한 작동 방식을 갖는다. 따라서 Array.prototype.findIndex()
레퍼런스를 그대로 보여주는 것을 참고(주의)하기 바란다.
구문
- 형식
typedArray.findIndex(callback[, thisArg])
매개 변수
findIndex()
는(은) Array.prototype.findIndex()
와(과) 동일한 작동 방식을 갖는다. 따라서 Array.prototype.findIndex()
레퍼런스를 그대로 보여주는 것을 참고(주의)하기 바란다.
- Functioncallback필수
배열의 각 원소에 대응하면서 실행할 콜백 함수(callback function)이며 찾는 대상과 일치하면 true
, 그렇지 않으면 false
를 반환해야 한다. 다음 세 개의 인자를 받는다.
- ObjectthisArg선택
콜백 함수(callback function)가 실행할 때 this
로 사용될 객체를 지정
반환
findIndex()
는(은) Array.prototype.findIndex()
와(과) 동일한 작동 방식을 갖는다. 따라서 Array.prototype.findIndex()
레퍼런스를 그대로 보여주는 것을 참고(주의)하기 바란다.
- Intindex
콜백 함수(callback function)를 통과한 최초 원소의 인덱스를 반환하며 그렇지 않다면 -1
을 반환한다.
지원 웹브라우저