jQuery Rounding

Robert Granlund
Robert Granlund used Ask the Experts™
on
Does the following round up?

<script>
var taxSum = 9.4558;
parseFloat(taxSum).toFixed(2)
</script>

Open in new window


Would that print out 9.4g ?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Developer & EE Moderator
Fellow 2018
Most Valuable Expert 2013
Commented:
It rounds  up and you would get 9.46
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed

What are you trying to do?
RobOwner (Aidellio)
Most Valuable Expert 2015

Commented:
No points, just to show you a demo http://jsbin.com/tovalavoko/edit?js,console,output

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial