𝗪𝗵𝗮𝘁 𝗔𝗿𝗲 𝗧𝘆𝗽𝗲𝗱 𝗔𝗿𝗿𝗮𝘆𝘀 𝗜𝗻 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁?

Regular JavaScript arrays hold any data type. This makes them slow for large data sets.

Typed arrays store only numbers of a fixed size. You pick the size and type when you create them.

Why use them?

Common types:

Example:

Regular array: [1, "hello", true] Typed array: new Uint8Array([255, 128, 0])

Typed arrays have a fixed size. The size does not change. They store only one number type.

Node.js Buffer uses Uint8Array.

Tip: Typed arrays are views. They look into a memory chunk called an ArrayBuffer.

Source: https://dev.to/ho3na3/what-are-typed-arrays-in-javascript-342p