DEV Community

Cover image for Is it important to know how Javascript work under the hood?
Toni
Toni

Posted on

Is it important to know how Javascript work under the hood?

After using javascript for all kind of projects and doing it professionally for almost a year (Developing React Native apps) I asked myself how does javascript work and does it really matter ? When i asked my friend that is much more experienced than me, he told me : Look Toni, it works. I don't care what it does under the hood.

Then one day i stumbled upon medium article named "Master the JavaScript Interview" or something like that, with bunch of questions I've heard about but i could't really answer them. There were bunch of questions like which paradigm javascript uses, difference between class and prototypal inheritance, pure functions, composition, call stack , callback queue...

Wait, maybe it does matter.

“Yes, there are two paths you can go by, but in the long run, there's still time to change the road you're on.” - Led Zeppelin

This is when I've started to dig deeper.

This article of course can't explain all of it but something that stuck with me on my journey of understanding javascript and something that i think can help a lot of you understand javascript better is this youtube video:

Event loop

It is focused on explaining what the heck "event loop" is but it explains so much more. I can't recommend this talk enough that i had to write a dev.to post about it.

Finally, after researching a lot i think i've changed the way i think. If you want code great websites, apps or anything else you have to understand the background , you have to understand how it works under the hood. It can save you so much time no matter which framework you are using Angular, Vue or React they are all based on javascript.

I would like to hear your opinion.

Thanks for reading :)

Top comments (5)

Collapse
 
gugocharade profile image
Abde Lazize • Edited

Knowing how Javascript works under the hood will help you avoid bugs and debugging your code faster. Also, keep in mind that making something work doesn't mean it is the right way, you should think of the time and memory usage.
Making something efficient is the hardest part but you can't achieve it without knowing how JavaScript works under the hood.
Besides, JavaScript works differently than other languages and there are a lot of weird things in it. Therefore you should go deeper and understand how it works and why it works like that.

Collapse
 
peerreynders profile image
peerreynders

It is focused on explaining what the heck "event loop" is but it explains so much more.

That 2014 video was good at the time (it doesn't cover promises (microtasks)).

These days:

(2018)

(2021)

Article: Tasks, microtasks, queues and schedules (2015)

Collapse
 
emgodev profile image
Michael

I think the more you understand of how programming languages work - even "under the hood" - and the further back we go in programming history to see how they solved their problems early on - heck even knowing more about the hardware limitations helps a ton - I think this all contributes greatly in software development and coding.

A small change of perspective I had when looking a little more into the event loop (and unrelated prototype inheritance) was that I did not need to treat my event handler functions as complex actions being performed when that event fires. Instead it's more like you are registering methods within the ongoing event loop which are called when that event type (of many) triggers. So now I'm not afraid of writing smaller and subsequent event handler calls rather than a big one.

Collapse
 
mac09 profile image
Habeeb Mac-iver

Understanding the inner workings make one better and more knowledgeable but one can also be good with Javascipt without knowing how things work under the hood.

Collapse
 
giorgionetg profile image
Giorgio Tedesco

I guess it is a must step of learning... When you have some libs that works Async way and other libs that work with promises. That's why is a must and need too.