In NodeJS, if we define functions using this keyword, it gets exposed.
for example:
// module.js
this.func1 = function () {
console.log('func1');
}
Then, If you require('module') you can access func1.
I want to know that how it is different than module.exports?
Thanks
Simple test: create new file and do:
which clearly shows that
thisis a reference tomodule.exports, i.e. there is no difference.