发布网友 发布时间:2022-04-24 14:04
共1个回答
热心网友 时间:2022-04-28 00:37
var arr=[{name: 'cst', age: '18'}, {name: 'jc', age: '20'}, {name: 'dxm', age: '50'} , {name: 'dcg', age: '30'}];
let brr=arr.filter(n => {
return n.name.indexOf('c')>-1;
}).map(a => {
a.age=(Number(a.age)+1).toString();
return a;
});
console.log(brr);
热心网友 时间:2022-04-28 00:37
var arr=[{name: 'cst', age: '18'}, {name: 'jc', age: '20'}, {name: 'dxm', age: '50'} , {name: 'dcg', age: '30'}];
let brr=arr.filter(n => {
return n.name.indexOf('c')>-1;
}).map(a => {
a.age=(Number(a.age)+1).toString();
return a;
});
console.log(brr);