Reid  Rohan

Reid Rohan


JavaScript Typed Arrays

An Introduction to Typed Arrays in JavaScript

We all must be familiar with JavaScript Arrays which are dynamic in nature and can hold any JavaScript object. But if you are familiar with languages such as C, you will know that arrays are not dynamic by nature. And you will only be able to store a specific data type in that array. But this makes sure that the array is more efficient from the performance perspective. But this does not make JavaScript Arrays inefficient. With the help of JavaScript engine optimizations, Arrays in JavaScript are quite fast thanks.

As web applications grew more powerful, there was a need for web applications to handle and manipulate raw binary data. JavaScript Arrays were unable to handle these raw binary data. Hence JavaScript typed arrays were introduced.

Typed Arrays

Typed Arrays are objects which are quite similar to Arrays, but provide a mechanism to write raw binary data into memory buffers. This feature is well supported across all major browsers and with ES6, they were integrated into the core JS framework and received access to Array methods such as map()filter(), etc. I highly advise you to go through the resources mentioned at the end of this article to gain in-depth knowledge of typed arrays.


Typed Arrays are implemented in such a way that they are structured as two main components. The two components that work hand-in-hand to implement typed arrays are the Buffer and View.


A Buffer is an object that is of type ArrayBuffer which represents a chunk of data. This chunk of raw binary data, cannot be accessed or modified on its own. You might wonder, what is the use of a data object which cannot be accessed or modified. Here is where a View comes into the picture.

#programming #technology #javascript

JavaScript Typed Arrays