Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

1 Answer
karthikeya Boyini

The set() function of TypedArray object accepts an array a number representing the index and copies the contents of the specified array in to the current array starting at the given index.

Syntax

Its Syntax is as follows

typedArray.set()

Example

Live Demo

<html>
   <head>
      <title>JavaScript Array every Method</title>
   </head>
   <body>
      <script type="text/javascript">
         var typedArray1 = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, 19, 8 ]);
         document.write("Contents of the typed array: "+typedArray1);
         document.write("<br>");
         var typedArray2 = new Int32Array([110, 215, 316, 916, 616, 117, 311 ]);
         typedArray1.set(typedArray2, 3);
         document.write("Result: "+typedArray1);
      </script>
   </body>
</html>

Output

Contents of the typed array: 11,5,13,4,15,3,17,2,19,8
Result: 11,5,13,110,215,316,916,616,117,311

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.