var arrayOfObj = [{id: 41, uid: "62d0e9d5-25d4"},
{id: 42, uid: "62d0e9d5-25d4},
{id: 43, uid: "62d0e9d5-25d4},
{id: 44, uid: "62d0e9d5-25d4}];
预期结果:a = [41,42,43];
答案 0 :(得分:1)
与Array#map
一起使用
arrayOfObj.map(a=>a.id)
答案 1 :(得分:0)
您可以使用javascript映射功能来实现。 在此处阅读文档:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map