| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/sort | [Back] [Original] |
Get to know MDN better
const uint8 = new Uint8Array([40, 10, 50, 20, 30]);
uint8.sort();
console.log(uint8);
// : Uint8Array [10, 20, 30, 40, 50]
sort()
sort(compareFn)
let numbers = new Uint8Array([40, 1, 5, 200]);
numbers.sort();
// Uint8Array [ 1, 5, 40, 200 ]
//
//
//
numbers = [40, 1, 5, 200];
numbers.sort();
// [1, 200, 40, 5]
numbers.sort((a, b) => a - b); //
// [ 1, 5, 40, 200 ]
| ECMAScript 2027 LanguageSpecification # sec-%typedarray%.prototype.sort |
| Web Proxy Viewer | New URL | Original Page |