Javascript
Apr 28, 2026
What is the output?
console.log(Boolean(0))
console.log(Boolean(""))
console.log(Boolean("0"))
Explanation
In JavaScript, 0 and empty string are falsy — they act like false. But "0" is a string with a character in it, so it is truthy — it acts like true. A common mistake is assuming "0" is false just because the number 0 is false.
📝
Reviewed by CodeShot Editorial
Every challenge is code-reviewed by senior developers to ensure accuracy and real-world relevance. Learn more.