์ƒˆ์†Œ์‹

๐Ÿ“ŒDevelop/Javascript ์ฃผ์„ฌ์ฃผ์„ฌ

javascript ์ˆซ์ž ์ฒœ ๋‹จ์œ„ ์ฝค๋งˆ ์ƒ์„ฑ

  • -
//์ฒœ๋‹จ์œ„ (,) ์ƒ์„ฑ
function numberWithCommas(number) {

  if(isNaN(number)){
    number = parseInt(number);
  }
  return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
๋ฐ˜์‘ํ˜•
Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.