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 subarray() function of the TypedArray object returns portion of the current array. It accepts two numbers representing the start and end of the sub array.

Syntax

Its Syntax is as follows

typedArray.subarray(5, 9)

Example

Live Demo

<html>
   <head>
      <title>JavaScript Example</title>
   </head>
   <body>
      <script type="text/javascript">
         var typedArray = new Int32Array([111, 56, 62, 40, 75, 36, 617, 2, 139, 827 ]);
         var result = typedArray.subarray(3, 7);
         document.write("Contents of the typed array: "+result);
      </script>
   </body>
</html>

Output

Contents of the typed array: 40,75,36,617

Advertisements

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