Reinin
12/18/2019 - 3:40 AM

3桁ずつ「,」をつける

function separatedPrice(price) {
  if (price) {
    return String(price).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
  }

  return price;
}