Standard built-ins
TypedArray.prototype.subarray()
Creates a view on the same backing buffer for the selected element range.
Formal Syntax & Structure
javascript syntaxjavascript
view.subarray(begin, end)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| begin | number | Starting element index. |
| end | number | Exclusive ending element index. |
Return Value
TypedArray
Creates a view on the same backing buffer for the selected element range.
Working Example
Example Snippetjavascript
(async () => {const a=new Uint8Array([1,2,3]);const v=a.subarray(1);v[0]=8;console.log(JSON.stringify([...a]),v.byteOffset);})()