DEV Community

Discussion on: Var, let and const- what's the difference?

Collapse
 
avrani profile image
Ariel

Hi, great article but I think you have a mistake about the hoisting,you wrote:
"They are all hoisted to the top of their scope but while var varvariables are initialized with undefined, let and const variables are not initialized."
If you will look at the JavaScript Hoisting section in w3schools.com website,
you will notice that:"Variables and constants declared with let or const are not hoisted!"
Please check in:
w3schools.com/js/js_hoisting.asp

Collapse
 
sobhardwaj profile image
Siddharath shankar bhardwaj

That's exactly I m thinking the new let and const in javascript are not hoisted..she wrote wrong things..u should correct this article..do not mislead people with this ??

Collapse
 
mohammedyehia profile image
Mohammed

According to MDN and ECMA 2015 her words are right
check this developer.mozilla.org/en-US/docs/W...