All challenges
Code AnalysisBeginner 60s

Value object mutability bug

class Money { constructor(public amount:number, public currency:string){} } const price = new Money(10,'USD'); const discounted = price; discounted.amount -= 2; console.log(price.amount); // 8 What design principle is violated?

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle