* Add Javascript questions * wip: add more questions * wip: add ternary operator * wip: add more questions * wip: add more questions * wip: add more questions * wip: add more questions * fix: set example * wip: add more questions * wip: add more question * wip: add more questions * wip: add more questions * wip: add more questions * wip: add more questions * wip: add more questions * wip: add more questions * wip: add more questions * wip: add another question * wip: add more questions * wip: add more questions * wip: add more questions * wip: add more questions * wip: add more questions * wip: add more questions * wip: add more questions * wip: add more questions
605 B
605 B
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution. This means that no matter where the functions and variables are declared, they are moved to the top of their scope regardless of whether their scope is global or local. Note that hoisting only moves the declaration, not the initialization.
console.log(x === undefined); // true
var x = 3;
console.log(x); // 3
The above code snippet can be visualized in the following way:
var x;
console.log(x === undefined); // true
x = 3;
console.log(x); // 3