EasyModern JS💻 Output Question

Template literal expressions

💡

Hint

Template literals evaluate any JS expression inside ${} — not just variables.

What does this output?

const a = 5, b = 10;
console.log(`${a} + ${b} = ${a + b}`);
console.log(`${a > b ? 'a wins' : 'b wins'}`);

Correct Output

5 + 10 = 15
b wins

Why this output?

Explanation: Template literals evaluate any expression inside ${}. a+b=15. a>b is false → "b wins".

Key Insight: Template literals evaluate any JS expression inside ${} — not just variables.

More Modern JS Output Questions

EasyDestructuring defaults apply only for undefinedEasyObject spread — later properties winMediumOptional chaining prevents TypeError on missing propertiesMediumNullish coalescing ?? vs OR ||

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz