/ Published in: JavaScript
URL: http://www.rgagnon.com/jsdetails/js-0076.html
Convert a number to a currency format, 100 => 100.00
Expand |
Embed | Plain Text
function formatAsMoney(mnt) { mnt -= 0; mnt = (Math.round(mnt*100))/100; return (mnt == Math.floor(mnt)) ? mnt + '.00' : ( (mnt*10 == Math.floor(mnt*10)) ? mnt + '0' : mnt); }
You need to login to post a comment.
