Nodejs Number Calculate doubleDigitalize()

Here you can find the source of doubleDigitalize()

Method Source Code

"use strict";/*from ww  w  .j  ava 2  s  . c  o  m*/

// Turns a single digit number to a double digit string
Number.prototype.doubleDigitalize = function() {
   const numberString = this.toString();
   return numberString.length < 2 ? "0" + numberString : numberString;
};

Related

  1. decorateFloat(decimals, decSeparator)
    Number.prototype.decorateFloat = function (decimals, decSeparator) {
      if(decSeparator == undefined)
        decSeparator = '.';
      var price = this;
      var decPattern = '';
      for(var i = 0; i < decimals; i++)
        decPattern += '0';
      price = price.roundFloat(decimals);
      var split = price.toString().split('.');
    ...
    
  2. digits()
    Number.prototype.digits = function() {
        return (Math.floor(this)+"").replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
    };
    
  3. discountPercentage(val)
    Number.prototype.discountPercentage = function(val){
      return this - this.percentage(val);
    };
    
  4. div10()
    Number.prototype.div10 = function () {
      return this/10;
    Object.prototype.say = function (s) {
     console.log('I say ' + s);
    var o = {};
    o.say("Hello");
    var n = 120;
    ...
    
  5. double()
    Number.prototype.double = function() {
      return this * 2;
    };
    
  6. equals(another)
    Number.prototype.equals = function (another) {
        return this - another === 0;
    };
    
  7. exp()
    Number.prototype.exp = function() {
      return Math.exp(this);
    };
    
  8. fe(x)
    Number.prototype.fe = function(x)
      var s = x.toString();
      var point = s.search(/\./);
      if (point == -1)
        return (Math.abs(this - x) < 0.5);    
      else
    ...
    
  9. fillZero(len)
    Number.prototype.fillZero = function (len)
      var s = this.toString(10);
      while (s.length<len) s = "0" + s;
      return s;