gpt4 book ai didi

javascript - var myFunction = function 函数名()

转载 作者:行者123 更新时间:2023-12-01 17:50:48 24 4
gpt4 key购买 nike

<分区>

我总是习惯这样写函数:

var myFunction = function(param) {
console.log(param);
};
myFunction('myFunction');

现在我看到了这个:

var otherFunction = function whyNameHere(param) {
console.log(param);
};
otherFunction('otherFunction');

我想知道 whyNameHere 是什么?什么时候以及为什么要这样写函数?我也可以像上面的 myFunction 函数一样调用它。为什么有人要写 whyNameHere?这种函数还有命名吗?

如果有人想玩,here is a fiddle

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