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

Quiz: Branching Strategies · Question 5 of 15

What does this print? (code)

What does this print?

const flags = { darkMode: false };
const user = { isTester: true };
console.log(flags.darkMode || user.isTester ? "new theme" : "old theme");
  1. A.old theme
  2. B.new theme
  3. C.false
  4. D.true
Answer & explanation

Correct answer: new theme

flags.darkMode is false but user.isTester is true, so the || expression is true and the new theme is shown.

Can you get the rest right without peeking?

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

Start the quiz →