How to do a reduce of decimal values?

Asked

Viewed 44 times

0

I need to use the reduce in Javascript, because I need to sum several simultaneous values that are contained in an array.

As I am using Typescript (Ionic3), the types of these variables are number, and not float or double.

When I execute reduce with integer numbers, everything goes well and returns the sum value.

But when I execute a decimal value for example 10,00 + 10,00 he returns me NAN.

Is there any difference between performing a reduce of decimal and integer values?

  • 1

    The right thing wouldn’t be 10.00?

  • Show the code where the sum is made.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.