View Full Version : pretty elementary problem ...
ASAAKI
11-03-2002, 05:10 PM
I've got a function that returns a percentage. The problem's that this percentage is excessively accurate, like 92.2342515878935733274732. Is there a function to get it down to 2 decimal places?
mordred
11-03-2002, 05:22 PM
// the percentage
var num = 92.234215878935733274732;
// newer browsers support toFixed()
document.write(num.toFixed(2));
// for older you have to use a little rounding trick
num = Math.round((num * 100 )) / 100;
document.write(num);
ASAAKI
11-03-2002, 05:26 PM
tnx:) , i feel stupid
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.