What is Hoisting in JavaScript?

Hoisting is the default behavior of JavaScript that moves all variable declarations to the top of the current scope. The scope may be the current script of the current function.

JavaScript Declarations are Hoisted. It means a variable can be used before it has been declared.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. For more information - please visit our private policy.