Javascript Array mapKey(key)

Description

Javascript Array mapKey(key)


// given an array of object, maps all values of the provided key
Array.prototype.mapKey = function(key) {
  return this.map(elem => {
    return elem[key]
  })//from   w  w  w  .j a va2s  .  co m
}



PreviousNext

Related