const arr = [
{id:"1",value:"11"},
{id:"2,value:"22"},
]
const arr2 = [{id:"2,value:"22"},]
数组处理:
const idSet = new Set(arr2.map(item => item.id));
const result = arr.map(arrItem => {...arrItem,value:idSet.has(arrItem.id)?"0":arrItem.value})
const arr = [
{id:"1",value:"11"},
{id:"2,value:"22"},
]
const arr2 = [{id:"2,value:"22"},]
数组处理:
const idSet = new Set(arr2.map(item => item.id));
const result = arr.map(arrItem => {...arrItem,value:idSet.has(arrItem.id)?"0":arrItem.value})