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
Can you describe what the Module Pattern is?
Design PatternsJavaScript SeniorExplain the concept of closures in JavaScript
JavaScript MediorExplain lexical scope in JavaScript
JavaScript MediorWhat does prototypal inheritance mean?
JavaScript Medior