Podcast
Questions and Answers
Which of the following statements correctly describes hoisting in JavaScript?
Which of the following statements correctly describes hoisting in JavaScript?
- It moves function declarations to the top of their respective function or global scope (correct)
- It moves both variable and function declarations to the top of their respective function or global scope
- It moves variable and function declarations to the bottom of their respective function or global scope
- It moves variable declarations to the top of their respective function or global scope
What is the difference between var and let/const in terms of hoisting?
What is the difference between var and let/const in terms of hoisting?
- var and let/const are not hoisted
- var is hoisted to the top of the function scope while let/const are hoisted to the top of the block scope (correct)
- var is not hoisted while let/const are hoisted to the top of the function scope
- var and let/const are hoisted to the top of the function scope
What is the potential issue with relying on hoisting in JavaScript?
What is the potential issue with relying on hoisting in JavaScript?
- It can cause variables to be undefined at runtime (correct)
- It can cause variables to be defined twice
- It can cause functions to be defined twice
- It can cause functions to be undefined at runtime
Flashcards are hidden until you start studying