Python if name == __main__ 的 NodeJS 等价物是什么
而在 Python 中你会使用
python_main_check.py
if name == "__main__":
# TODO 你的代码放在这里在 NodeJS 中你可以简单地使用
node_main_check.js
if (require.main === module) {
// TODO Your code goes here
}Check out similar posts by category:
JavaScript, NodeJS
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow