🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: JavaScript Basics: all 9 questions

Quiz: JavaScript Basics · Question 5 of 9

What does this print? (code)

What does this print?

const x = 0;
console.log(x || 10, x ?? 10);
  1. A.10 10
  2. B.10 0
  3. C.0 0
  4. D.0 10
Answer & explanation

Correct answer: 10 0

|| replaces any falsy value (0 → 10); ?? replaces only null/undefined (0 stays).

Can you get the rest right without peeking?

Take the timed Quiz: JavaScript Basics quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →