Javascript Number toMyCurrencyString()

Description

Javascript Number toMyCurrencyString()



//  ==========================
//  TO MY CURRENCY STRING
//  ==========================
Number.prototype.toMyCurrencyString = function() {
  // Reg expression thanks to http://stackoverflow.com/users/28324/elias-zamaria
  return this.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
};



PreviousNext

Related