JavaScript typedArray.BYTES_PER_ELEMENT Property
Last Updated :
15 Feb, 2023
The typedArray.BYTES_PER_ELEMENT is an inbuilt property in JavaScript that is used to return the size in bytes of each element in a given typedArray.
Syntax:
typedArray.BYTES_PER_ELEMENT;
Parameter: It does not accept any parameter because it is a property, not a function.
Return value: It returns the size in bytes of each element in a given tyepedArray.
Example :
javascript
a = Int8Array.BYTES_PER_ELEMENT;
b = Uint8Array.BYTES_PER_ELEMENT;
c = Uint8ClampedArray.BYTES_PER_ELEMENT;
d = Int16Array.BYTES_PER_ELEMENT;
e = Uint16Array.BYTES_PER_ELEMENT;
f = Int32Array.BYTES_PER_ELEMENT;
g = Uint32Array.BYTES_PER_ELEMENT;
h = Float32Array.BYTES_PER_ELEMENT;
i = Float64Array.BYTES_PER_ELEMENT;
console.log(a);
console.log(b);
console.log(c);
console.log(d);
console.log(e);
console.log(f);
console.log(g);
console.log(h);
console.log(i);
|
Output:
1
1
1
2
2
4
4
4
8
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...