以下是一段将[{"id":1,"name":"毛刺","QtyNumber":6},{"id":2,"name":"上色不均匀","QtyNumber":1}],写js代码只要name和QtyNumber
时间: 2023-05-13 07:07:21 浏览: 79
可以使用以下代码来提取name和QtyNumber:
let data = [{"id":1,"name":"毛刺","QtyNumber":6},{"id":2,"name":"上色不均匀","QtyNumber":1}];
let result = data.map(item => ({name: item.name, QtyNumber: item.QtyNumber}));
console.log(result);
输出结果为:
[{name: "毛刺", QtyNumber: 6}, {name: "上色不均匀", QtyNumber: 1}]
阅读全文