Module Maze · Level 2 of 8

require() waits for the whole file

A log before the require, a log inside the module, and a log after.

main.cjs
console.log('before');const b = require('./b.cjs');console.log('after, got ' + b.value);
b.cjs 2 lines
console.log('b.cjs body');module.exports = { value: 42 };

1. Predict the output

Tap the lines in the order you think they print.

  1. 1…
  2. 2…
  3. 3…