How does hoisting work in JavaScript?

  • Assignments are moved to the top of the scope during compilation
  • Declarations are moved to the top of the scope during compilation
  • Functions are moved to the top of the scope during compilation
  • Variables are moved to the top of the scope during runtime
Hoisting in JavaScript refers to the behavior where function declarations are moved to the top of the scope during compilation, allowing them to be used before they are declared.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *