This page was translated from English by the community.Learn more and join the MDN Web Docs community.
TypedArray.prototype.sort()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2016년 9월.
sort() 메서드는적소에 형식화 배열의 요소를 정렬하여 그 형식화 배열을 반환합니다. 이 메서드는Array.prototype.sort()와 같은 알고리즘입니다.TypedArray는 여기형식화 배열 유형 중 하나입니다.
In this article
구문
js
typedarray.sort([compareFunction]);매개변수
compareFunctionOptional정렬 순서를 정의하는 함수를 지정합니다.
예
더 많은 예는,Array.prototype.sort() 메서드도 참조하세요.
js
var number = new Uint8Array([40, 1, 5, 200]);function compareNumbers(a, b) { return a - b;}numbers.sort(compareNumbers);// Uint8Array [ 1, 5, 40, 200 ]명세
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-%typedarray%.prototype.sort> |