Monday, May 20, 2024
157
rated 0 times [  164] [ 7]  / answers: 1 / hits: 22608  / 8 Years ago, mon, february 29, 2016, 12:00:00

Sample Example:


var amount = 100; 
alert(amount); // output: 100

How can i achieve output as 100.0?


More From » floating-point

 Answers
82
var amount = 100;
alert(amount.toFixed(1)); // output: 100.0
alert(amount.toFixed(2)); // output: 100.00
alert(amount.toFixed(3)); // output: 100.000

[#63117] Friday, February 26, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
adrienkeithr

Total Points: 503
Total Questions: 126
Total Answers: 110

Location: Lithuania
Member since Fri, Sep 4, 2020
4 Years ago
;