[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Rounding and Truncating
I am looking for a neat little JS function to accept a decimal as
input and return a string with the dollar value of the number, rounded to
the nearest penny. Soo far I have a very rudimentary (non-working) version:
function dollar_it (input) {
var holder = "";
anyText = input;
var i = anyText.indexOf(".");
i += 2;
for( var x = 0; x <= i; x++ )
holder += anyText.charAt(x);
}
If anyone has any ideas/suggestion, please let me know.
Steve Weinberger