Nodejs Array Multiply mul(value)

Here you can find the source of mul(value)

Method Source Code

Array.prototype.mul = function(value) {
   var newArray = new Array();
   for(var i=0; i<this.length; i++) {
      newArray[i] = this[i] * value;//ww w.j  a v  a  2 s  .c  om
   }
    return newArray;
}

Related

  1. mult(other)
    Array.prototype.mult = function(other) {
        if(isFinite(other))  
            other = new Array(this.length).fill(other);
        else
            console.assert(this.length == other.length, 'mult: len(a) != len(b)');
        var ret = new Array(this.length);
        for(var i = 0; i < ret.length; i++)
            ret[i] = this[i] * other[i];
        return ret;
    ...
    
  2. mult2()
    Array.prototype.mult2 = function() {
        for (var i = 0; i < this.length; i++) {
            this[i] = this[i] * 2;
    };
    
  3. multipleConcat()
    Array.prototype.multipleConcat = function() {
        var initialArray = arguments[0];
        if (arguments.length > 0) {
          for (var i = 1, arrayCount = arguments.length; i < arrayCount; i++ ) {
            initialArray.push.apply(initialArray, arguments[i]);
          return initialArray;
    };
    ...
    
  4. multiples(multiple)
    Array.prototype.multiples = function(multiple) {
      var multiples = [];
      for (var i = 0; i < this.length; i++){
        multiples.push(this[i] * multiple);
      return multiples;
    console.log([1,2,3,4,5].multiples(5));
    Array.prototype.myEach = function(someFunction){
    ...