What does converting to a float mean?

Post a reply

:
In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: What does converting to a float mean?

What does converting to a float mean?

Post by admin » Tue May 23, 2017 7:59 pm

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:

Top

cron