cf.completefrontend

Predict the outputHard

What does this log when a default parameter's closure and the function body both use x?

What does this log?
var x = "global";
 
function f(read = () => x) {
  var x = "body";
  return read();
}
 
function g(x = "param", read = () => x) {
  var x = "body";
  return [x, read()];
}
 
console.log(f());
console.log(g());

The answer

Work out every line it logs, in order. Then check.

Checking your sign-in…