Javascript Array toObject(projection)

Description

Javascript Array toObject(projection)

Array.prototype.toObject = function (projection) {
  var result = {};
  for (var i = 0; i < this.length; i++)
    result[this[i][projection]] = this[i];
  return result;//from w  w w.  j  a v  a 2s . c  o  m
};



PreviousNext

Related