So I have a value in Javascript:
var val = Entry.val;
One example of this value is 277385. How do I, in Javascript, convert th
I'm not sure why the other answers split the number on a decimal point- you can replace, starting with a digit,until there are no more digits. It will quit when it runs out of digits or hits a non-digit.
function addCommas(n){
var rx= /(\d+)(\d{3})/;
return String(n).replace(/^\d+/, function(w){
while(rx.test(w)) w= w.replace(rx,'$1,$2');
return w;
});
}