출처 : http://stackoverflow.com/questions/2901102/how-to-print-number-with-commas-as-thousands-separators-in-javascript



function numberWithCommas(n) {
   
var parts=n.toString().split(".");
   
return parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",") + (parts[1] ? "." + parts[1] : "");
}

출처 URL 페이지 상단부터 쭉~ 내려 오다보면, 위 펑션이 나오는데, 길어진 펑션이 이렇게 짧게 되었다.

세상은 넓고, 능력자는 많다.

+ Recent posts