Puzzle 11 of 15 · var hoisting
Read a function that logs a var binding before and after its assignment. Predict both lines while considering declaration timing. Choose an output below, then check the explanation. No signup needed. Browse puzzles by topic →
1function peek() { 2 console.log(value); 3 var value = 7; 4 console.log(value); 5} 6peek();
Predict the console output. Each line is a separate log.
ReferenceError
7 7
undefined 7
null 7