dict1中存在的以下键值将在dict2中更新,其中包含与开头相同数量的键值对。
var dict1={name:"alex",1:"24",office:"germany"} //original dictionary
var dict2=dict1; //copy of original dict1
funct(dict1){
//code that is used to change the values of dict1 to the following values.
}
console.log(dict1); //dict1:{0:"alex",undefined:24,2:"germany"}
funct(dict1,dict2){
let {undefined:val} = dict1; //deleting the undefined key-value pair from dict1
delete dict1["undefined"];
console.log(dict1); //dict1:{0:"alex",2:"germany"}
//how can i update the dict2 with the values present in the dict1?
//the final dict2 should have following values:
console.log(dict2); //dict2={0:"alex",1:"24",2:"germany"}
}