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
Samual Sam

The BYTES_PER_ELEMENT property of the Typed Array represents the number of bytes in each element in it.

Syntax

Its Syntax is as follows

Float32Array.BYTES_PER_ELEMENT;

Example

Live Demo

<html>
   <head>
      <title>JavaScript Example</title>
   </head>
   <body>
      <script type="text/javascript">
         var sizeOfFloat64Array = Float32Array.BYTES_PER_ELEMENT;
         document.write("Size of the float 32 array: "+sizeOfFloat64Array);
         document.write("<br>");
         var sizeOfInt16Array = Int16Array.BYTES_PER_ELEMENT;
         document.write("Size of the int 16 array: "+sizeOfInt16Array);
      </script>
   </body>
</html>

Output

Size of the float 32 array: 4
Size of the int 16 array: 2

Advertisements

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