Page 1 of 1

What does converting to a float mean?

PostPosted: Tue May 23, 2017 7:59 pm
by admin
When somebody tells you that you need to convert to a float it means that a second stage or more is required to process a string. For example:

Q.- I want to remove commas from the string and calculate those amount using javascript.

For example : I have those two values -

400,000.00
200,000.00

Now I want to remove commas from those string and want the total of those amount.

A.- To remove the commas, you'll need to use replace on the string. To convert to a float so you can do the maths, you'll need parseFloat: