Leaderboard Archive
Javascript Apr 15, 2026

What gets logged?

function foo() {
  console.log(a)
  var a = 10
}
foo()
A 10
B ReferenceError
C undefined
D null
Explanation
Hoisting. var declarations are moved to the top of their function scope, but values are not.
📝
Reviewed by CodeShot Editorial
Every challenge is code-reviewed by senior developers to ensure accuracy and real-world relevance. Learn more.

Ready for your shot?

Join thousands of developers solving one logic puzzle every morning.

Solve Today's Challenge →