JavaScript typedArray.buffer() and typedArray.byteLength() with Example Last Updated : 22 Dec, 2022 Comments Improve Suggest changes Like Article Like Report The Javascript typedArray.buffer() is a property in JavaScript which represents the ArrayBuffer referenced by a typedArray and the property typedArray.byteLength() represents the length of the typedArray in bytes. Syntax: typedArray.buffer typedarray.byteLength Parameters: It does not accept any parameter because it is a property, not a function. Return values: It doesn't return any value. JavaScript examples to show the working of this property: Example 1: In this example we will see the basic use of the JavaScript typedArray.buffer() and typedArray.byteLength() property in Javascript. javascript <script> // creating some ArrayBuffers with a size in bytes const buffer1 = new ArrayBuffer(8); const buffer2 = new ArrayBuffer(12); const buffer3 = new ArrayBuffer(20); const buffer4 = new ArrayBuffer(22); const buffer5 = new ArrayBuffer(4); // Creating typedArray object for above buffers const A = new Uint16Array(buffer1); const B = new Uint16Array(buffer2); const C = new Uint16Array(buffer3); const D = new Uint16Array(buffer4); const E = new Uint16Array(buffer5); // Getting the length of the arrayBuffer console.log(A.byteLength); console.log(B.byteLength); console.log(C.byteLength); console.log(D.byteLength); console.log(E.byteLength); </script> Output: 8 12 20 22 4 Comment More infoAdvertise with us Next Article JavaScript typedArray.buffer() and typedArray.byteLength() with Example S ShivamKD Follow Improve Article Tags : JavaScript Web Technologies javascript-functions javascript-typedArray Similar Reads JavaScript arrayBuffer byteLength Property The Javascript arrayBuffer.byteLength is a property in JavaScript that return the length of an ArrayBuffer in a byte. ArrayBuffer is an object which is used to represent fixed-length binary data. Difference between property and function in javascript. Property in JavaScript is nothing but a value w 4 min read JavaScript typedArray.byteOffset Property The typedArray.byteOffset is an inbuilt property in JavaScript that is used to return the offset in bytes of a given typedArray from the start of its ArrayBuffer. Syntax: typedArray.byteOffset Parameter: It does not accept any parameter because it is a property, not a function. Return value: It retu 1 min read Node.js Buffer.byteLength() Method The Buffer.byteLength() method is used to return the length in bytes of the specified buffer object. Syntax: Buffer.byteLength( string, encoding ) Parameters: This method accepts two parameters as mentioned above and described below: String It is a required parameter and is used to specify the obje 1 min read What is the use of TypedArray Object in JavaScript ? Introduction: Arrays in Java and C++ are data structures, that are of fixed-size contiguous and store homogeneous data. These arrays utilize contiguousness and caching to improve performance thus reducing the random access time. However, JavaScript arrays are different beasts. Unlike typical arrays, 4 min read JavaScript typedArray.length() Method The typedArray.length is an inbuilt property in JavaScript which is used to return the length of the given typedArray. Syntax: typedArray.length Parameters: It does not accept any parameter because it is a property not a function. Return value: It returns the length of the given typedArray. Example 2 min read Like