Javascript Array transform(transformation)

Description

Javascript Array transform(transformation)


Array.prototype.transform = function (transformation) {

  var i = 0;//from   w  ww . j  a va 2  s  .co m
  var result = [];

  for (i = 0; i < this.length; i += 1) {
    result.push(transformation(this[i]));
  }

  return result;
};



PreviousNext

Related