以下引用阮一峰网道 https://wangdoc.com/javascript/types/function.html#%E7%AC%AC%E4%B8%80%E7%AD%89%E5%85%AC%E6%B0%91
看下边的例子:
function text(person) { person.age = 40 person = { name: 'yyyyy', age: 30 } return person } const p1 = { name: 'aaaaa', age: 25 } const p2 = text(p1) console.log(p1); console.log(p2);
打印结果:
{name: "aaaaa", age: 40}
{name: "yyyyy", age: 30}