Answer the question
In order to leave comments, you need to log in
How to translate the number 1 617.78 from string into a numeric value with 2 numbers after the decimal point?
How to convert the number 1 617.78 from string to integer with 2 numbers after the comma (or dot)?
Tried like this:
parseFloat(тут число 1 617.78 которое вытягивается из атрибута data).toFixed(2)
Answer the question
In order to leave comments, you need to log in
Integer is an integer. Therefore, the answer to your question is "no".
PS 1 617.78 already with two digits after the decimal point (or dot).
The code
will return
Although I am confused by the space in your number.
PS
If the problem is in the space and you have a problem with the wording, then here:
data='1 123.32245'
num=parseFloat(data.replace(' ','')).toFixed(2)
parseFloat(num)
>>1123.32
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question