🚧 under construction
Last updated 2 years ago
Was this helpful?
⟩ ⟩ ⟩ var is statement
(side effects)
var is a statement, instead of a declaration:
it doesn't follow normal rules.
may create side effects:
global var / function is global object property❗️
var redeclaration applied even in strict mode❗️
var has no block scope❗️
📘 JS spec ⟩
var statement declares variable(s) that are scoped to the 's VariableEnvironment.
var variable(s) are created when their containing is instantiated and are initialized to undefined when created.
Within the scope of any VariableEnvironment a common may appear in more than one but those declarations collectively define only one variable.
A variable defined by a with an is assigned the value of its 's when the is executed, not when the variable is created.
stop using var❗️
statement expected❗️
📘 JS spec ⟩ ⭐️
⟩ ⟩
⭐️⭐️⭐️ ❗️❗️❗️
VariableEnvironment
Environment Record