What if Array didn’t exist? Creating JS arrays from scratch

When I found out that classes in JS were nothing but syntatic sugar, I decided I wanted to get a solid understanding on what was going on behind the scenes when we use the class keyword.

What better to do that than to re-create an extremely commonly used class such as Array also used as []. Here you can see a little codesandbox with a very simple and minimal implementation of what arrays built from scratch in JS could look like.


JS Array - CodeSandbox

JS Array - CodeSandbox

Copyright 2022 © Borja Leiva

Made within London