Author:
erics, February 27th, 2015
The .toFixed(2) method will round off the value of the field to 2 decimal places
|
decimalNumTwoPlaces = parseFloat(this.value.toFixed(2)); |
Categories: How-To's, Technology Tags: Decimal, Floating, Floating Point, howto, javascript, Round, Rounding, tips, toFixed
| No comments
Author:
erics, September 23rd, 2012
|
var num = 10; var result = num.toFixed(2); // result will equal 10.00 var num= 170.2305; var result = num.toFixed(3); // result will equal 170.231 |
Categories: How-To's, Technology Tags: Decimal, Format, Format Number, howto, javascript, JS, Number, Number Format, Places, Round, Rounding, tips, toFixed
| No comments