DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR JAVASCRIPT
javascript tofixed only if decimal
var
formattedNumber
=
(
x
*
1.5
)
.
toFixed
(
2
)
.
replace
(
/
[.,]00$
/
,
""
)
;
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#javascript
#tofixed
#decimal
ADD COMMENT
Topic
COMMENT
Name
6+9 =
Submit