Equivalent of Underscore.js _.pluck in jQuery

后端 未结 4 803
闹比i
闹比i 2020-12-30 00:38

Does anyone know of a \'pluck\' plugin that matches the underscore array method?

pluck_.pluck(list, propertyName) 

A convenient version of

4条回答
  •  臣服心动
    2020-12-30 00:51

    You can do it with an expression;

    var arr = $.map(stooges, function(o) { return o["name"]; })
    

提交回复
热议问题