What is the meaning of JavaScript Hoisting?

What is the meaning of JavaScript Hoisting?
A. Moving declarations to bottom
B. Moving declarations to top
C. Hosting variables by itself
D. Moving declarations to specified location
 
Answer: b
Explanation: Hoisting is JavaScript’s default behavior of moving all declarations to the top of the current scope (to the top of the current script or the current function). 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.
This set of JavaScript Questions and Answers for Campus interviews focuses on “Comparison of Core JavaScript versus Frameworks – II”.
 

Tìm kiếm

Back
Top