bhylu.com

Advertisements

Typed Reference

Choose the view type according to element width and interpretation. Bytes and element counts are not always the same.

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

JavaScript

const readings = new Float32Array([1.5, 2.5]);
console.log(readings.length, readings.byteLength);

What happens

Two four-byte elements occupy eight bytes.