心有法竹
const obj1 = {"name":"","age":"","salary":""};const obj2 = [ {"desc":"年龄",content:"25"}, {"desc":"薪资",content:"3000"}, {"desc":"姓名",content:"李杰"}];//汉英字典映射const dict = { "年龄":"age", "薪资":"salary", "姓名":"name"}const obj3 = {...obj1};obj2.forEach(item=>{ if(item.desc in dict){ const key = dict[item.desc]; const value = item.content; obj3[key] = value; }});console.log(obj3);