Nodejs Number Calculate mult()

Here you can find the source of mult()

Method Source Code

Number.prototype.mult = function() {
    var w = this;
    for (var i = 0; i < arguments.length; i += 1)
        w *= arguments[i];//from   w w w  . j ava 2 s  .co m
    return w;
}
var n = 12;
console.log(n.mult(2, 3));
console.log((5).mult(2, n));

Related

  1. int()
    var num = 5;
    Number.prototype.int = function(){ 
          return parseInt(this) ;
    Number.prototype.float = function(){ 
          return this.toFixed(2);
    console.log(num.float());
    console.log(num);
    ...
    
  2. intToHSL()
    Number.prototype.intToHSL = function() {
        var shortened = this % 360;
        return "hsl(" + shortened + ",45%,56%)";
    };
    
  3. max(maximum)
    Number.prototype.max = function(maximum) {
        if (this.valueOf() > maximum){
          return maximum;
        } else {
          return this.valueOf();
    };
    
  4. min(minimum)
    Number.prototype.min = function(minimum) {
        if (this.valueOf() < minimum){
          return minimum;
        } else {
          return this.valueOf();
    };
    
  5. modNumber.prototype.mod || (n)
    Number.prototype.mod = Number.prototype.mod || function(n) {
      return ((this%n)+n)%n;
    
  6. next()
    Number.prototype.next = function(){
        return this+1;
    };
    
  7. normalize(num)
    Number.prototype.normalize = function(num) {
      return this*180/num;
    };
    
  8. ordenar()
    #!/usr/bin/env node
    Number.prototype.ordenar = function () {
      return this.toString().split('').sort(up).join('');
    };
    function up (a,b) {
      return a > b ? 1 : a < b ? -1 : 0;
    var x = 0;
    var done= false;
    ...
    
  9. ordinal()
    Number.prototype.ordinal = function () {
        return this + (
            (this % 10 == 1 && this % 100 != 11) ? 'st' :
            (this % 10 == 2 && this % 100 != 12) ? 'nd' :
            (this % 10 == 3 && this % 100 != 13) ? 'rd' : 'th'
            );
    var ResetInput = function(){
        jQuery('input, textarea').each(function() {
    ...