| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray | [Back] [Original] |
Get to know MDN better
const uint8 = new Uint8Array([10, 20, 30, 40, 50]);
console.log(uint8.subarray(1, 3));
// : Uint8Array [20, 30]
console.log(uint8.subarray(1));
// : Uint8Array [20, 30, 40, 50]
subarray()
subarray(begin)
subarray(begin, end)
begin end begin end
const buffer = new ArrayBuffer(8);
const uint8 = new Uint8Array(buffer);
uint8.set([1, 2, 3]);
console.log(uint8); // Uint8Array [ 1, 2, 3, 0, 0, 0, 0, 0 ]
const sub = uint8.subarray(0, 4);
console.log(sub); // Uint8Array [ 1, 2, 3, 0 ]
| ECMAScript 2027 LanguageSpecification # sec-%typedarray%.prototype.subarray |
| Web Proxy Viewer | New URL | Original Page |