Interesting that "let" and "const" did not inherit the hoisting behavior. I've come to understand that "var" should not be used going forward as of ES6 in favor of let and const... was this a deliberate decision to remove the hoisting behavior from Javascript altogether in time?
The main reason for this is because let and const are block scoped. var on the other hand is not and therefore can be hoisted up to the global context (as long as 'use strict' is not present).
Interesting that "let" and "const" did not inherit the hoisting behavior. I've come to understand that "var" should not be used going forward as of ES6 in favor of let and const... was this a deliberate decision to remove the hoisting behavior from Javascript altogether in time?
The main reason for this is because
let
andconst
are block scoped.var
on the other hand is not and therefore can be hoisted up to the global context (as long as'use strict'
is not present).Indeed, thanks for the added clarification James. I'll add that in. I'll blockquote you! 😊