Puzzle 5 of 15 · Nullish coalescing
Compare logical OR (||) and nullish coalescing (??) when a score is zero. Predict which value each defaulting expression selects. Choose an output below, then check the explanation. No signup needed. Browse puzzles by topic →
1const score = 0; 2console.log(score || 10); 3console.log(score ?? 10);
Predict the console output. Each line is a separate log.
0 0
10 0
10 10
0 10