Design Patterns · Senior · Question 74 of 75
Why are Value Objects useful for money amounts on the frontend?
const total = Money.of(1999, 'EUR').add(Money.of(500, 'EUR'));- ✓Correct answer: They bundle amount and currency, enforce rules (no adding EUR to USD) and avoid floating-point mistakes by using minor units
- 2They make numbers faster
- 3They're required by
Intl.NumberFormat
Explanation
Immutable value objects compare by value and centralize formatting and rounding rules.