r/javascript • • Feb 09 '20

“Hoisting” doesn’t really exist in JavaScript! 😱 according to ECMAScript

https://medium.com/nmc-techblog/what-is-hoisting-in-javascript-bf73980d9dac
0 Upvotes

7 comments sorted by

View all comments

1

u/agentgreen420 Feb 10 '20

This is idiotic. Why would code be literally moved around?

0

u/talJoffe Feb 10 '20

from w3school (just an example it is like this in most places):
"Hoisting is JavaScript's default behavior of moving declarations to the top."
https://www.w3schools.com/js/js_hoisting.asp

1

u/mcaruso Feb 10 '20

I mean, it's not like a W3Schools tutorial is going to be talking about compile phases and execution phases. The description is just a conceptual one, and works fine as such.

2

u/talJoffe Feb 10 '20

You are right and many developers don't know that and take it literally.
This is similar to other parts of Javascript like "scope" and "this" in that it is simple if you know it but many developers don't