js 取数组中某个对象的集合
程序员文章站
2022-07-03 09:28:25
var arr = [ {a:1,b:2,c:3}, {a:4,b:5,c:6}, {a:7,b:8,c:9} ]; arr1=[]; arr.forEach(function(v){ arr1.push(v.a);}); console.log(arr1); ......
var arr = [ {a:1,b:2,c:3}, {a:4,b:5,c:6}, {a:7,b:8,c:9} ]; arr1=[]; arr.forEach(function(v){ arr1.push(v.a);}); console.log(arr1);