DataViews
DataView reads and writes different numeric types at chosen byte offsets. Specify byte order for interoperable binary formats.
Where to run this
This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.
A practical example
const view = new DataView(new ArrayBuffer(4));
view.setUint16(0, 513, true);
console.log(view.getUint16(0, true));
What happens
Reading with the same little-endian order returns 513.