Getting the values for a specific key from all objects in an array

后端 未结 7 1967
醉酒成梦
醉酒成梦 2020-12-15 04:32

I\'m running an express.js app that has a few apis feeding data to dropdown boxes. The data returned is in the form:

  [
    {
        key: \'blah\',
                


        
相关标签:
7条回答
  • 2020-12-15 05:12

    Pure Javascript ES6

    array.map(value => value.key);
    

    Underscore/Lodash

    _.map(value,'key')
    
    0 讨论(0)
提交回复
热议问题