What is hoisting and what do you know about it?

Experience Level: Medior
Tags: JavaScript

Answer

Hoisting is JavaScript's default behavior of moving declarations to the top.

  • In JavaScript, a variable can be declared after it has been used. In other words; a variable can be used before it has been declared.
  • JavaScript only hoists declarations, not initializations.
Related JavaScript job interview questions

Comments

No Comments Yet.
Be the first to tell us what you think.