EasyModern JS💻 Output Question

Object spread — later properties win

💡

Hint

In object spread, later properties override earlier ones. Order matters.

What does this output?

const base     = { x: 1, y: 2 };
const override = { y: 20, z: 3 };
const merged   = { ...base, ...override };
console.log(merged.x);
console.log(merged.y);
console.log(merged.z);

Correct Output

1
20
3

Why this output?

Explanation: override.y=20 overwrites base.y=2. x and z are unique to their source.

Key Insight: In object spread, later properties override earlier ones. Order matters.

More Modern JS Output Questions

EasyDestructuring defaults apply only for undefinedMediumOptional chaining prevents TypeError on missing propertiesMediumNullish coalescing ?? vs OR ||EasyTemplate literal expressions

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz