← 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");
- A.old theme
- B.new theme
- C.false
- 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 →