TypedArray.BYTES_PER_ELEMENT property in JavaScript

HTMLJavascriptProgramming Scripts

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
raja
Published on 30-Oct-2018 13:32:18
Advertisements