Number.prototype.addCommas = function(n){
n = this.toString();
var l = n.length;
var a = [];
while((l-=3)>0){
a.unshift(n.substr(l,3));
}
a.unshift(n.substr(0,3+l));
return a.join(",");
}
n = 427453458492;
trace(n.addCommas());
// traces 427,453,458,492 (as a string)