Node.js examples for Number:Currency
Format Money
function formatamoney(c) { var t = this;//from www. ja v a2s.c o m if (c == undefined) c = 2; var p, d = (t = t.split("."))[1].substr(0, c); for (p = (t = t[0]).length; (p -= 3) >= 1;) { t = t.substr(0, p) + "." + t.substr(p); } return t + "," + d + Array(c + 1 - d.length).join(0); }