JavaScript: Hoisting [ variable and function ]

Hoisting deals with variables or function usage before its definition. Hoisting happens for the variables defined with “var”. For the variables defined with “let” or constants defined with “const”, hoisting will not happen. Hoisting happens for both variables and functions.