1 votes

Why is the result not rounded?

I have two variables in NodeJS with these values:

 valor1 = 3.06;
valor2 = 2.20;

console.log("Resultado de la resta 3.06 - 2.20", valor1 - valor2);

The result you are giving me is 0.8599999999 instead of giving me 0.86 since they only have two decimal places after the comma.

Why is this happening?

HolaDevs.com

HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by:

X