var ss={
name:'你不好',
id:123
}
var bb={
name:'你好',
id:520,
year:'1212',
he:'王八蛋'
}
//ss=Object.assign(ss,bb);
//console.log(ss)//{name: "你好", id: 520, year: "1212", he: "王八蛋"}
var cc={};
for(var i in bb){
for(var o in ss){
if(i==o){
cc[i]=bb[i]
}
}
}
console.log(cc) //{name: "你好", id: 520}
网友评论