Which fix removes the bug?
const price = 19.99; const label = price.toFixed(2) + 5; console.log(label);
- Add first:
(price + 5).toFixed(2)instead - Add first:
(price + 5).toString(2)instead - Change
+ 5to+ '5'in the line - Call
parseInton the label afterwards
toFixed returns a string, so + 5 concatenates instead of adding.
Play Problem Solving ▸