The set()
method stores multiple values in the typed array, reading input values from a specified array.
typedarray.set(array[, offset]) typedarray.set(typedarray[, offset])
array
typedarray
ArrayBuffer
; the JavaScript engine will intelligently copy the source range of the buffer to the destination range.offset
Optional
A RangeError
, if the offset
is set such as it would store beyond the end of the typed array.
var buffer = new ArrayBuffer(8); var uint8 = new Uint8Array(buffer); uint8.set([1, 2, 3], 3); console.log(uint8); // Uint8Array [ 0, 0, 0, 1, 2, 3, 0, 0 ]
Specification |
---|
ECMAScript (ECMA-262) The definition of 'TypedArray.prototype.set' in that specification. |
Desktop | ||||||
---|---|---|---|---|---|---|
set |
7 | 14 | 4 | 10 | 11.6 | 5.1 |
Mobile | ||||||
---|---|---|---|---|---|---|
set |
4 | 18 | 4 | 12 | 4.2 | 1.0 |
Server | |
---|---|
set |
0.10 |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set