floating point - How to format a float in javascript?

Опубликовано: 30 Сентябрь 2024
на канале: Code Samples
532
7

#short
#javascript
#floating-point
In JavaScript, when converting from a float to a string, how can I get just 2 digits after the decimal point? For example, 0.34 instead of 0.3445434.
The specifics: http://www.javascriptkit.com/javatuto...
toFixed: https://developer.mozilla.org/en-US/d...
Tim Büthe: https://stackoverflow.com/questions/6...