var is hoisted, whereas
const are not hoisted.
But is that really true? Technically NO.
Hoisting: JS engine physically places the variables at the top of the code during execution.
As per MDN: Conceptually, for example, a strict definition of hoisting suggests that variable and function declarations are physically moved to the top of your code, but this is not in fact what happens. …
So, who the hell is
In layman’s terms,
this points to the owner of the function call, I repeat, the function call, and NOT the function itself. The same function can have different owners in different scenarios.
4 rules decide the value of
this in Default Binding points to the global object. Default binding is applied for standalone functions and is the fallback option for all other types. …