Is there any reason to define module.exports using an IIFE?
问题 My team doesn't have any experienced JS developers, but we are writing a library in Node and got a suggestion from a real JS developer that "We should make the js more modular - not to pollute the global namespace and to make it more readable to new-comers", and told us to do the following: module.exports = (function(){ return { nameToExpose: functionToExpose ... }; })(); rather than module.exports.nameToExpose = functionToExpose; What's the point of this, if any? The latter does not make any