|
Variables defined outside any function, block, or module scope have global scope. We can access variables in global scope from any point in the application. Global variables are available for the lifetime of the application.
stored in global scope |
check_circle |
cancel |
cancel |
|
|
|
Variables that are declared inside a function are called local variables and in the function scope. Local variables are accessible anywhere inside the function.
function scope |
check_circle |
check_circle |
check_circle |
|
|
|
Variable that is declared inside a specific block & can’t be accessed outside of that block. In order to access the variables of that specific block, we need to create an object for it.
block scope |
cancel |
check_circle |
check_circle |
|
|
|
When variables are reassigned, their value changes to that of the newer value specified, and the previous value is lost.
can be reassigned |
check_circle |
check_circle |
cancel |
|
|
|
To redeclare a variable simply means to declare an already declared variable or identifier regardless of whether in the same block or outer scope.
can be redeclared? |
check_circle |
cancel |
cancel |
|
|
|
In JavaScript, hoisting refers to the built-in behavior of the language through which declarations of functions, variables, and classes are moved to the top of their scope – all before code execution. In turn, this allows us to use functions, variables, and classes before they are declared
can be hoisted? |
check_circle |
cancel |
cancel |
|
|