JavaScript中的main()函数? [英] main() function in JavaScript?
问题描述
我在一些我遇到的JavaScript文件中看到过 main()
函数。它是否与您在其他语言中使用的主要功能相同,例如C#,C ++?如果在JS文件中放置一个main函数,代码是否开始执行?或者它只是用于函数的另一个名称?
I have seen a main()
function in some JavaScript files I have come across. Is it the same main function as you use in other languages such as C#, C++?? If you put a main function in your JS file, is that where the code starts executing? Or is it just another name used for a function?
我在网上搜索过但没有找到任何有用的信息。
I have searched the web but didn't find anything useful regarding this matter.
推荐答案
不, main
在JavaScript中与在C语言中不同。它只是另一个函数,但原始程序员可能会使用该名称作为约定来指示代码应开始运行的位置。
No, main
is not the same in JavaScript as in C languages. It's just another function, but the original programmer is probably using the name as a convention to indicate where the code should start running.
这篇关于JavaScript中的main()函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!