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 2015년 7월.
subarray() 메서드는 이 TypedArray 객체와 동일한 ArrayBuffer 저장소에 동일한 요소의 타입을 가진 새로운 TypedArray를 반환합니다. 시작 오프셋은 포함하고 마지막 오프셋은 제외합니다. TypedArray는 타입이 지정된 배열 유형 중 하나입니다.
시작할 요소입니다. 오프셋 값은 포함되어 있습니다. 이 값을 명시하지 않으면 배열 전체가 새로운 뷰에 포함됩니다.
end Optional마지막 요소입니다. 오프셋 값은 제외합니다. 이 값을 명시하지 않으면 begin에 지정된 요소부터 배열 끝까지 모든 요소가 새로운 뷰에 포함됩니다.
새로운 TypedArray 객체.
begin과 end으로 명시된 범위는 현재 배열의 유효한 인덱스 범위로 고정됩니다. 새 배열의 계산된 길이가 음수인 경우 0으로 고정됩니다. begin 또는 end가 음수인 경우 배열의 시작이 아닌 끝의 인덱스를 참조합니다.
또한 명심하셔야 할 점은 기존 버퍼에 새로운 뷰(view)를 생성하는 것뿐입니다. 새 객체의 내용을 변경하면 원래 객체에 영향을 미치며 그 반대의 경우도 마찬가지입니다.
| ECMAScript® 2027 Language Specification # sec-%typedarray%.prototype.subarray |
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.