Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2016년 9월.
TypedArray 인스턴스의 findIndex() 메서드는 주어진 판별 함수를 만족하는 배열의 첫 번째 요소에 대한 인덱스를 반환합니다. 만족하는 요소가 없으면 -1을 반환합니다. 이 메서드는 Array.prototype.findIndex()와 같은 알고리즘을 가집니다.
형식화 배열의 각 요소마다 실행할 함수입니다. 일치하는 요소가 발견되었음을 나타내는 참 같은 값을 반환하고 그렇지 않으면 거짓같은 값을 반환해야합니다. 함수는 다음과 같은 인수와 함께 호출됩니다.
element형식화 배열에서 처리 중인 현재 요소입니다.
index형식화 배열에서 처리 중인 현재 요소의 인덱스입니다.
arrayfindIndex() 함수가 호출된 형식화 배열입니다.
thisArg OptionalcallbackFn을 실행할 때 this로 사용할 값입니다. 순회 메서드를 참고하세요.
테스트를 통과하는 첫 번째 요소의 인덱스입니다. 일치하는 요소가 없으면 -1을 반환합니다.
보다 자세한 설명은 Array.prototype.findIndex()을 참고하시기 바랍니다. 이 메서드는 범용 메서드가 아니며 오직 형식화 배열 인스턴스에서만 호출할 수 있습니다.
다음 예제에서는 배열에서 소수인 첫번째 요소의 인덱스를 찾습니다. 소수가 없으면 -1을 반환합니다.
| ECMAScript® 2027 Language Specification # sec-%typedarray%.prototype.findindex |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025년 2월 11일 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.