Skip to main content
JavaScript Output Prediction Easy +10 XP

Boolean Conversion

What is the output?

JavaScriptRead-only
console.log(Boolean(""));
console.log(Boolean("0"));

What is the output?

Show answer and explanation

Answer: false then true

Empty string is falsy, but '0' is a non-empty string so it's truthy.

Hint: Only empty string is falsy.

What this challenge tests

Output Prediction in JavaScript: booleans, truthy-falsy.

Related challenges