Vidyalelo
JavaScript · Q3

Caching And Debugging

Programming · JavaScript · question 3

Q3

What will happen if you reference document.location from within an object?

A.
Traverses the queue
B.
Finds the bugs
C.
Traverses the stack
Answer
D.
None of the mentioned

Answer: Option C

Solution

Answer: Option C
Solution:
If you reference document.location from within an object, the interpreter will need to go from the function that references the variable, up out of the namespace to the global window scope, down to the document scope, and get the location value.