Convert javaScript floating point numbers to strin

2019-09-20 19:33发布

问题:

when converting javascript floating point numbers to string format insignificant trailing decimal zeros are lost.

for an example

var num = 20.0;
altert(num);

will give output as 20

how can i stop removing insignificant decimal trailing zeros when formatted as string

回答1:

Answer that was already given

Please take above reference