[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/toSorted [Back]  [Original]

TypedArray.prototype.toSorted() - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

TypedArray.prototype.toSorted()

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2023 7.

TypedArray toSorted() sort() . . Array.prototype.toSorted() .

In this article

js
toSorted()
toSorted(compareFn)

compareFn Optional

. . sort() .

.

Array.prototype.toSorted() . , .

Array.prototype.sort() .

js
const numbers = new Uint8Array([40, 1, 5, 200]);
const numberSorted = numbers.toSorted();
console.log(numberSorted); // Uint8Array [ 1, 5, 40, 200 ]
//   ,    
//    .
console.log(numbers); // Uint8Array [ 40, 1, 5, 200 ]

Specification
ECMAScript 2027 LanguageSpecification
# sec-%typedarray%.prototype.tosorted


Web Proxy Viewer  |  New URL  |  Original Page