Javascript Number USD()

Description

Javascript Number USD()


const formatter = Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: 'USD',
  minimumFractionDigits: 2//from   w  w  w.j a v  a  2  s.  co m
});

Number.prototype.USD = function () {
  return formatter.format(this);
};

Number.prototype.isEven = function () {
  return this % 2 === 0;
};



PreviousNext

Related