See this variable comparison below? I& #39;ve seen it shared in a few places. Problematic thing about it is that a lot in it is incorrect. Please always double check information before you believe it.
THREAD
#100daysofcode #codenewbies #freecodecamp #tech #javascript #programming
THREAD
#100daysofcode #codenewbies #freecodecamp #tech #javascript #programming
A variable is function scoped or block scoped, not both. Var is function scoped, let and const are block scoped. Vars are only added to a global object if they are defined in the global scope...
If you define a variable with the & #39;var& #39; keyword in a nested scope then it won& #39;t be stored in the global scope. Lastly, all var, let, and const are hoisted. The thing is that for the last two an error will be thrown if they are used before initialisation...
This is also known as Temporal Dead Zone (TDZ). This article explains variable hoisting and TDZ ( https://blog.bitsrc.io/hoisting-in-modern-javascript-let-const-and-var-b290405adfda).">https://blog.bitsrc.io/hoisting-...