Javascript String toCurrency()

Description

Javascript String toCurrency()

String.prototype.toCurrency = function() {
  return parseFloat(this).toFixed(2).replace(/\d(?=(\d{3})+[\.\0]+)/g, (x) => x + ',');
};



PreviousNext

Related