cf.completefrontend

Predict the outputMedium

What does this log when a function reads a name that it declares with const further down?

What does this log?
const x = "outer";
 
function test() {
  console.log(typeof x);
  const x = "inner";
  console.log(x);
}
 
test();
console.log(x);

The answer

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

Checking your sign-in…