Differences between three different ways using module.exports
I saw some people use different ways to create a class but I really don't
know the differences or advantage using inline, use name or without
function name. For example:
// Style 1. Use module.exports on a var
var myClass = function MyClass() {
return something;
}
module.exports = myClass;
// Style 2. inline module.exports
module.exports = function MyClass() {
return something;
}
// Style 3. inline module.export without function name
module.exports = function () {
return something;
}
can anyone please explain or tell me the differences? I guess that using
with function name will give much more info on stack trace?
Thanks
No comments:
Post a Comment