EasyType Coercion💻 Output Question

Plus operator: string concat vs numeric add

💡

Hint

+ prefers string concatenation when either side is a string. - always forces numeric conversion.

What does this output?

console.log(1 + '2');
console.log('3' - 1);
console.log(true + false);
console.log(null + 1);

Correct Output

12
2
1
1

Why this output?

Explanation: 1+"2": + with string → "12". "3"-1: - forces numeric → 2. true+false: 1+0=1. null+1: null→0, 0+1=1.

Key Insight: + prefers string concatenation when either side is a string. - always forces numeric conversion.

More Type Coercion Output Questions

MediumLoose equality edge cases with nullEasytypeof for common valuesMediumTruthy and falsy — empty array and object are truthyMediumUnary plus converts to number

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz