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

Which fix removes the bug?

const total = '5' + 3;
console.log(total === 8);
  1. Coerce with Number()
  2. Compare with ==
  3. Swap the operands
  4. Use a template string
+ concatenates when either side is a string, producing '53' rather than 8.
Play Problem Solving ▸