I rewrote Array in JavaScript but as Object!

Rakesh Purohit
3 min readMar 13, 2022

Nearly everything in JS is an object.

Note: I could have used OOP to make the code better, reusable and robust. I was in so hurry to try out the experiment and do some code as talk is cheap. (😉)

Well, it is true. Even [a,r,r,a,y] is also an object in JavaScript.

I have heard that too often. Also, I had only one inquiry. “HOW?” When I began my excursion in Javascript, I had this idea. What’s more, as I continued to learn, I discovered that inside javascript regards the Array as JSON.

I had this data for quite a while as a javascript developer. One great day, while getting back, this thought hit me (and not a vehicle 🚗), assuming somebody could get it done, Why mightn’t? Why not make an effort to execute an array in JavaScript Object all alone to perceive how it functions? It would be enjoyable. I have the beneath picture as wallpaper:

A Richard Feynman Quote

Hold on before we go to the code!

--

--

Rakesh Purohit
Rakesh Purohit

Responses (2)