Standard built-ins

DataView.prototype.getFloat32()

Try the free JavaScript compiler

Reads a 32-bit floating-point number at an arbitrary byte offset. The entire value must fit in the view; otherwise a RangeError is thrown.

Formal Syntax & Structure

javascript syntaxjavascript
view.getFloat32(byteOffset, littleEndian?)

Parameters & Attributes

NameTypeDescription
byteOffsetnumberStarting byte offset within the view.
littleEndianbooleanTrue for little-endian; omitted or false means big-endian.

Return Value

number

Decoded value.

Working Example

Example Snippetjavascript
const view=new DataView(new ArrayBuffer(5)); view.setFloat32(1,1.5,true); console.log(String(view.getFloat32(1,true)));
JavaScript Reference