Nodejs Utililty Methods Float Format

List of utility methods to do Float Format

Description

The list of methods to do Float Format are organized into topic(s).

Method

toNumFixed(num)
Number.prototype.toNumFixed = function (num) {
  return parseFloat(this.toFixed(num));
splitThousands()
Number.prototype.splitThousands = function () {
    var s = this.toString();
    var thousands = Math.floor(this / 1000).toString();
    return this > 999 ? ("{0} {1}").format(thousands, s.slice(thousands.length, s.length)) : s;
};
to2Digits()
Number.prototype.to2Digits = function () {
   return this.toFixed(2).toString().replace(".", ",");
};