← Quiz: Scope, Closures, Hoisting and this: all 15 questions
Quiz: Scope, Closures, Hoisting and this · Question 3 of 15
What does this print? (code)
What does this print?
console.log(typeof hello);
var hello = "hi";
- A.undefined
- B.string
- C.ReferenceError
- D.hi
Answer & explanation
Correct answer: undefined
var declarations are hoisted and start as undefined, so typeof gives "undefined".
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 →