Typed Arrays & ArrayBuffer in JavaScript
Typed arrays (Uint8Array, Float64Array, ...) are fixed-length views over raw ArrayBuffer memory — numeric computing, binary protocols, WebGL, and audio's native tongue. No holes, no mixed types, no methods that resize: O(1) indexed numeric access with C-like performance characteristics.
DataView reads mixed types and endianness from one buffer (getUint16 with littleEndian flags); TextEncoder/Decoder bridge strings and bytes (UTF-8). Buffers transfer between workers (zero-copy via transferables) — the high-performance JS substrate.
Buffer plus view
new ArrayBuffer(16) allocates raw bytes; new Uint8Array(buf) views them as numbers — allocation and interpretation separated.
Fixed length, numeric only
Length set at construction, elements coerced numerically — out-of-range writes wrap or clamp, never grow.
DataView for mixed layouts
getUint16/getFloat32 with endianness flags parse binary formats field by field.
Strings cross via codecs
TextEncoder().encode(str) → bytes; TextDecoder().decode(bytes) → str — the UTF-8 bridge.
let buf = new ArrayBuffer(4);let bytes = new Uint8Array(buf);bytes[0] = 255;console.log(bytes.length, bytes[0]);Recommended resourcesAffiliate links · may earn us a commission
Recommended for learners
Practice what you learned
Re-implement each visualized algorithm in JavaScript yourself — building beats watching.