DEV Community

Discussion on: 🔥🕺🏼 JavaScript Visualized: Hoisting

Collapse
 
apisurfer profile image
Luka Vidaković

It's a nice refreshment to see gifs that break up the text to digestible chunks while also helping with the visualization. Keep it up!

Hoisting is often explained as putting variables and functions to the top of the file

I can see why it's described that way to some extent. Parser needs to go over the whole file/script, and it only does something meaningful with functions, and vars at first. So at the top of the file, very first line, you already have the access to those identifiers.

Collapse
 
lydiahallie profile image
Lydia Hallie

It’s just important to understand that the parser is not actually physically moving them to the top - as some people like to explain it

Collapse
 
apisurfer profile image
Luka Vidaković

Yup I agree. Semantically it only makes difference with vars, but you descriptions are to the point 👌

Thread Thread
 
shafkathullah profile image
Shafkathullah Ihsan

Testing comment UI...

Thread Thread
 
shafkathullah profile image
Shafkathullah Ihsan • Edited

2Testing comment UI...