3 ms·
And that is similar to require's behavior for properties on the returned object. const foo = require("foo"); // starts out as empty object exports.bar =
by paulddraper 3y ago
And that is similar to require's behavior for properties on the returned object.
const foo = require("foo"); // starts out as empty object
exports.bar = function() {
return foo.fn();
}
- rezonant 3y agoYes but the difference is that this: let x = require('foo').x of course, cannot do that. It's a small difference but it does make it easier to fall into the happy path in more cases.