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

TypedArray.prototype.toSorted() - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

TypedArray.prototype.toSorted()

Baseline

20237

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

js
toSorted()
toSorted(compareFn)

compareFn

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 ]

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


Web Proxy Viewer  |  New URL  |  Original Page