What is an ArrayBuffer in JavaScript?
Short answer
An ArrayBuffer is a fixed-length, raw binary data buffer in memory. It has no way to read or write data directly — you need a "view" like a TypedArray or DataView layered on top of it to interpret the bytes as numbers.
Advertisement
AModel answer
An ArrayBuffer is a fixed-length, raw binary data buffer in memory. It has no way to read or write data directly — you need a "view" like a TypedArray or DataView layered on top of it to interpret the bytes as numbers.
const buffer = new ArrayBuffer(16); // 16 bytes of raw memory
console.log(buffer.byteLength); // 16Real-world example
Used when working with binary file data, WebSocket binary frames, or the Web Audio API.
Likely follow-ups
- How is an ArrayBuffer different from a regular JS array?
Related topics