CodePeek
Practice / ValuesBack to CodePeek

JavaScript Truthiness: An empty surprise

Puzzle 4 of 15 · Truthiness

Compare Boolean conversion for an empty array and an empty string. Predict each log by considering the type and truthiness of the value. Choose an output below, then check the explanation. No signup needed. Browse puzzles by topic →

Values / TruthinessJavaScript
console.log(Boolean([]));
console.log(Boolean(""));

Predict the console output. Each line is a separate log.

What’s the output?

Choose the output

Starter puzzles 15