Nodejs Number Sum sum(a)

Here you can find the source of sum(a)

Method Source Code

Number.prototype.sum = function (a) {
    return a = a || 0,this + a;
}
num = 4;/*from w w  w  .  j a v a2 s.c o  m*/
num.sum(4).sum(5).sum(6);

Related

  1. sum( number )
    Number.prototype.sum = function ( number ) {
        return this + Number(number);
    };
    var one = 1;
    console.log( one.sum(1) );
    console.log( one.sum(" 3.04 ") );
    console.log( one.sum("w") );
    
  2. sum(num)
    Number.prototype.sum = function(num) {
        return this + num;
    };