Typed Array set()
Examples
// Create a Typed Array
const myArr = Int16Array.from([10,15,20,25,30,35,40,45,50]);
// Set new Values
myArr.set([1,2,3]);
Try it Yourself »
// Create a Typed Array
const myArr = Int16Array.from([10,15,20,25,30,35,40,45,50]);
// Set new Values
myArr.set([1,2,3], 4);
Try it Yourself »
Description
The set() method stores values in a typed array from another array.
The set() method can be a given a start position.
Syntax
typed-array.set(array, offset)
Parameters
| Parameter | Description |
| offset | Optional. Start position (inclusive). Default is 0. |
Return Value
| The typed array modified. |
JavaScript Typed Arrays
Browser Support
typed-array.set() is an ECMAScript6 (ES6 2015) feature.
JavaScript 2015 is supported in all browsers since June 2017:
| Chrome 51 |
Edge 15 |
Firefox 54 |
Safari 10 |
Opera 38 |
| May 2016 | Apr 2017 | Jun 2017 | Sep 2016 | Jun 2016 |