P
P
pcdesign2020-04-22 08:44:09
JavaScript
pcdesign, 2020-04-22 08:44:09

How to remove extra zeros?

As numbers of the form:
7.0 lead to 7
1.34 -> 1.34
2.0 -> 2

In short, if after the point zero, then remove it. And if there are decimals or hundredths, then leave it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-04-22
@pcdesign

parseFloat('7.0'); // 7
parseFloat('1.34'); // 1.34
parseFloat('2.0'); // 2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question