$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · easy · #83

Which fix removes the bug?

const price = 19.99;
const label = price.toFixed(2) + 5;
console.log(label);
  1. Add first: (price + 5).toFixed(2) instead
  2. Add first: (price + 5).toString(2) instead
  3. Change + 5 to + '5' in the line
  4. Call parseInt on the label afterwards
toFixed returns a string, so + 5 concatenates instead of adding.
Play Problem Solving ▸