← Quiz: Scope, Closures, Hoisting and this: all 15 questions
Quiz: Scope, Closures, Hoisting and this · Question 7 of 15
In which direction does the scope chain look for a variable?
In which direction does the scope chain look for a variable?
- A.From the global scope inward
- B.From the current scope outward to enclosing scopes, ending at global
- C.Randomly through all functions
- D.Only in the current scope
Answer & explanation
Correct answer: From the current scope outward to enclosing scopes, ending at global
Inner code can read outer variables, but outer code cannot read inner ones.
Can you get the rest right without peeking?
Take the timed Quiz: Scope, Closures, Hoisting and this quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →