JavaScript DataView Reference Last Updated : 27 Mar, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report JavaScript dataView is used to control how we can access data, regardless of executing endianness. And provides an interface to read and write more than one number types into an ArrayBuffer. Syntax: new DataView(buffer, byteOffset, byteLength) Example: JavaScript code to show the working of dataView(). JavaScript // Creating an ArrayBuffer with a size in bytes var buffer = new ArrayBuffer(16); // Creating views var view1 = new DataView(buffer); // Creating view from byte 0 for the next 4 bytes var view2 = new DataView(buffer,0,4); // Creating view from byte 12 for the next 2 bytes var view3 = new DataView(buffer,12,2); // Putting 1 in slot 0 view1.setInt8(0, 1); // Putting 2 in slot 12 view1.setInt8(12, 2) // Printing the views console.log(view2.getInt8(0)) console.log(view3.getInt8(0)) Output: 1 2 The complete list of JavaScript Strings has listed below: JavaScript DatView Constructor: A constructor gets called when an object is created using the new keyword. ConstructorDescriptionDatView()Create dataView objects or returns a new DataView object that will represent the specified data buffer. JavaScript DatView Properties: A JavaScript property is a member of an object that associates a key with a value. Instance Property: An instance property is a property that has a new copy for every new instance of the class.Instance PropertiesDescriptionconstructorReturn the dataView constructor method for the object.bufferAn ArrayBuffer that is already existing to store the new DataView object.byteLengthStart a new view of the buffer. By default, the new view starts from the first byte.byteOffsetIt represents number of elements in the byte array. JavaScript DatView Methods: Methods are actions that can be performed on objects. Instance Method: If the method is called on an instance of a dataView then it is called an instance method. Instance Methods Description getFloat32() Get a 32-bit float at the specified location. getFloat64() Get a 64-bit float at the specified location. getInt8() Get an 8-bit integer in the byte at the specified location. getInt16() Get a 16-bit integer at the specified location. getInt32() Get a 32-bit integer at the specified location. getUint8() Get an unsigned 8-bit integer at the specified location. getUint16() Get an unsigned 16-bit integer at the specified location. getUint32() Get an unsigned 32-bit integer at the specified location. setFloat32() Get an assigned 32-bit float value at the specified location. setFloat64() Get an assigned 64-bit float value at the specified location;. setInt8() Get an signed 8-bit integer at the specified location. setInt16() Get an assigned 16-bit integers at the specified location. setInt32() Get an assigned 32-bit integers at the specified location. setUint8() Get an unsigned 8-bit integer at the specified location. setUint16() Get an unsigned 16-bit integer at the specified location. setUint32() Get an unsigned 32-bit integer at the specified location. Comment More infoAdvertise with us Next Article JavaScript dataView.setUint8() Method K kartik Follow Improve Article Tags : JavaScript Web Technologies Similar Reads JavaScript dataView.setInt8() Method The dataView.setInt8() is an inbuilt function in dataView that is used to store a signed 8-bit integer at the specified location i.e, at byte offset from the start of the dataView. Syntax: dataView.setInt8(byteOffset) Parameters: It has the parameter byteOffset which is offset in byte i.e from the s 2 min read JavaScript dataView.setUint8() Method The dataView.setUint8() is an inbuilt function in dataView that is used to store an unsigned 8-bit integer at the specified location i.e, at byte offset from the start of the dataView. Syntax: dataView.setUint8(byteOffset) Parameters: It has the parameter byteOffset which is offset in a byte and it 2 min read JavaScript dataView.setInt16() Method The dataView.setInt16() is an inbuilt function in dataView that is used to store a signed 16-bit integer at the specified location i.e at byte offset from the start of the dataView. Syntax: dataView.setInt16(byteOffset) Parameters: It has the parameter byteOffset which is offset in a byte and it say 2 min read JavaScript dataView.setInt32() Method The dataView.setInt32() is an inbuilt function in dataView that is used to store a signed 32-bit integer at the specified location i.e, at byte offset from the start of the dataView. Syntax: dataView.setInt32(byteOffset) Parameters: It has the parameter byteOffset which is offset in a byte and it sa 2 min read JavaScript dataView.setUint16() Method The dataView.setUint16() is an inbuilt function in dataView that is used to store an unsigned 16-bit integer at the specified location i.e, at byte offset from the start of the dataView. Syntax: dataView.setUint16(byteOffset) Parameters: It has the parameter byteOffset which is offset in a byte and 2 min read JavaScript dataView.setUint32() Method The dataView.setUint32() is an inbuilt function in dataView which is used to store an unsigned 32-bit integer at the specified location i.e, at byte offset from the start of the dataView. Syntax: dataView.setUint32(byteOffset,ValueToStoreAsUint32) Parameters: byteOffset is the offset from the start 2 min read Like