Skip to main content
Journey Uncommon Logo
JourneyUncommon
easyNodeJSrequire and module.exportsSingle-choice MCQ

You have a CommonJS file that does `module.exports = function () {}` and then, on the next line, also does `exports.foo = 1`. What does another file get when it calls `require()` on this module?

// math.js module.exports = function () {}; exports.foo = 1; // app.js const m = require('./math'); console.log(typeof m, m.foo);