Javascript Array doubleArray()

Description

Javascript Array doubleArray()



Array.prototype.doubleArray = function () {
  double = [];//  w  ww . java  2  s .  c  o  m

  for( i = 0; i < this.length ; i++) {
    double.push(this[i]*2);
  }
  return double;
}

a = [1,2,3,4,5,6];
console.log(a.doubleArray());



PreviousNext

Related