gpt4 book ai didi

javascript - 在返回变量中使用括号的优点

转载 作者:行者123 更新时间:2023-11-28 08:26:32 24 4
gpt4 key购买 nike

有时我会在网络教程中看到这一点:

/**
* Just for example
*/
function getConstructor() {

/**
* Constructor fn, that will be returned by 'getConstructor' fn
*/
function SomeTypeConstructor() {
// some code
}

//////////////////////////////////////////////////
// And here is the question!
// What is this parentheses for?
return( SomeTypeConstructor );
}

谁能告诉我这个括号是做什么用的吗?

最佳答案

由于 return 是一个语句,而不是一个方法,因此不需要括号。

关于javascript - 在返回变量中使用括号的优点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22332749/

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