toFixed() doesn't seem to work... why? #289
Replies: 4 comments
-
Posted at 2014-06-18 by DrAzzy Number.toFixed() returns a string with the specified format. What you would want to do is:
or
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-18 by @gfwilliams Thanks @drazzy As far as I'm aware that's never worked, so I'm not quite sure why everything was fine for you before! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-19 by d0773d DrAzzy, thanks for your help. Gordon, your right the code never worked. Which explains why I was getting erratic values from my sensor readings. Now, my sensor readings are stable. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-07-05 by d0773d Code that works:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-06-18 by d0773d
Life happened so I put my project to the side for a couple of months. I decided to pick the project back up today and updated the firmware on the Espruino. By the way I really like the new GUI of the IDE :-)
The issue I am having is toFixed(2) doesn't seem to get the decimal place to only two decimal places. toFixed(2) seemed to work before I took a break from my project.
I hit the Send to Espruino button. I get the following output.
CODE:
Beta Was this translation helpful? Give feedback.
All reactions