这是我的功能:
function myFunction(theObject) {
theObject.make = 'Saab';
}
var mycar = {
make : "volvo";
model :1992;
};
做类似this:console.log( myFunction(myCar));
它不应该打印出 volvo
而不是 undefined
吗?
最佳答案
没有。您不会从 myFunction
返回任何内容,它只是隐式返回 undefined
。
关于javascript - 试图理解将对象传递给函数的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37930053/