0

Does anyone know what's causing this error when converting a string of "1.14" to a number?

And most importantly, how to eliminate any risk of incorrect conversions like this one:

console.log(parseInt(parseFloat("1.14") * 100) / 100); // prints 1.13 instead of 1.14
Vlad
  • 465
  • 7
  • 26

1 Answers1

1

console.log(Number("1.14") * 100 / 100);

Your issue will be resolved by applying this solution for more detail you can refer this answer

Parth Raval
  • 4,097
  • 3
  • 23
  • 36