Hint
Hoisting rules are the same in ES modules. Function declarations hoist completely; const/let are in TDZ. Import statements are hoisted (evaluated first), unlike require().
// In JS modules, what does this log?
// Assume these run as module code
console.log(add(2, 3));
function add(a, b) { return a + b; }
console.log(multiply(2, 3));
const multiply = (a, b) => a * b;5 ReferenceError: Cannot access 'multiply' before initialization
Explanation: Function declarations are fully hoisted β add() works. const multiply is in TDZ until its declaration β accessing it throws ReferenceError. Same rules apply in modules.
Key Insight: Hoisting rules are the same in ES modules. Function declarations hoist completely; const/let are in TDZ. Import statements are hoisted (evaluated first), unlike require().