假设我有如下代码:
var moduleVar = "I belong to this module, you could also call me a static var";
var ClassName = function() {
var instanceVar = "I belong to this instance";
function someFunction(functionVar) {
var anotherFunctionVar = "I belong to this function";
return 1;
}
}
module.exports = ClassName;
我已经搜索了有关Node的命名约定,但没有找到任何涉及此问题的内容。 我喜欢在实例变量前加下划线(例如“_instanceVar”),但我仍然困在函数和模块变量之间的区别上。
是否存在一种命名约定来区分它们?