gpt4 book ai didi

javascript - 试图理解将对象传递给函数的含义

转载 作者:行者123 更新时间:2023-11-30 07:34:34 25 4
gpt4 key购买 nike

这是我的功能:

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com