Variables Flashcards
Get a fucking job
What is var?
A statement that declares function-scoped or globally-scoped variables, optionally initializing each to a value.
Variables declared with var are hoisted (they are processed before any code execution).
Only the variable declaration is hoisted, not its initialization.
What is let?
A statement that declares re-assignable, block-scoped local variables, optionally initializing each to a value.
What is const?
A statement that declares block-scoped local variables. The value of a constant can’t be changed through reassignment using the assignment operator, but if a constant is an object, its properties can be added, updated or removed.
What is the TDZ?
Temporal Dead Zone. A variable is said to be in the TDZ from the start of the block until code execution reaches the place where the variable is declared and initialized.
What is hoisting?
Process in which the parser/interpreter appears to move the declaration of functions, variables, classes or imports to the top of their scope, prior to the execution of the code.
What is nullish coalescing?
A logical operator (??) that returns its right-hand side operand when its left-hand side operand is null or undefined. Otherwise, it returns its left-hand side operand.