If 42 and 42.00 both are handled the same way ... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If 42 and 42.00 both are handled the same way ...

If 42 and 42.00 both are handled the same way in JS, how do I ensure that, when my user interacts with my page, my webpage provides output with/without decimals as desired?

19th Jun 2017, 3:45 PM
Ferhat Acar
Ferhat Acar - avatar
2 Answers
0
conver the output to integers?
19th Jun 2017, 3:50 PM
Baard Helmen
Baard Helmen - avatar
0
Use string manipulation functions to figure out wether the output have decimal point or not. If not append decimal point to the output followed by zeros.
11th Jul 2017, 11:56 AM
Rakesh