var sourceData = { userList:[{name:‘liujinyu‘,age:30},{name:"zhangsan",age:20}] } var getInfo = () => { const {userList} = sourceData; const __info= {}; userList.forEach(({name,age}) => { __info[name] = age; }); getInfo = () => __info; return __info; } console.log(getInfo()) //但是还是能改写getInfo()的返回值 getInfo().lisi = 40
?
?
?
?
?