-
Sun 2019.08.11
You beat me to it
toFixed()
@AkosLukacs, as I was in the process of documenting a discovered anomaly while prepping my response.as a mod to your example will show
>var kwh = 1234.505; >console.log(kwh.toFixed(2)) 1234.50
Is this another anomaly but withtoFixed()
? (re: "The number is rounded if necessary" )https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed
"toFixed() returns a string representation of numObj that does not use exponential notation and has exactly digits digits after the decimal place. The number is rounded if necessary, and the fractional part is padded with zeros if necessary so that it has the specified length."
YES just posted
I think you don't have to format the
currentkWh
on the puck.Just use
toFixed
on the display page. For example:Separation of data & display concerns :)