gpt4 book ai didi

JavaScript 参数,意外数字错误

转载 作者:行者123 更新时间:2023-12-03 08:03:12 25 4
gpt4 key购买 nike

解析以下参数时,console.log 指出这两个数字(参数)是意外的。这是为什么?我该如何修复这个错误?

function max(20, 20) {
return width * height;
}
console.log(max(width, height));

最佳答案

应该是这样的(你的参数不能是直接值,它应该是变量。在调用它们时你应该使用值)

function max(width, height) {
return width * height;
}
console.log(max(20,20));

关于JavaScript 参数,意外数字错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34509829/

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