← Quiz: Scope, Closures, Hoisting and this: all 15 questions
Quiz: Scope, Closures, Hoisting and this · Question 12 of 15
What does this print? (code)
What does this print?
console.log(greet());
function greet() { return "hello"; }
- A.hello
- B.undefined
- C.It throws a ReferenceError
- D.It throws a TypeError
Answer & explanation
Correct answer: hello
Function declarations are hoisted completely, so they can be called before their line.
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 →