Leaderboard Archive
Javascript Apr 26, 2026

What does this output?

console.log(null + 1)
console.log(undefined + 1)
A 1 and 1
B 1 and NaN
C null and undefined
D NaN and NaN
Explanation
null converts to 0 when used in math, so null + 1 = 1. undefined converts to NaN (Not a Number), and any math with NaN gives NaN. This trips up a lot of developers — null and undefined behave very differently in arithmetic.
📝
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 →