cf.completefrontend

Predict the outputHard

Does changing a variable in finally change what the function returns?

What does this log?
function getCount() {
  let count = 1;
  try {
    return count;
  } finally {
    count = 2;
    console.log("finally sees", count);
  }
}
 
function getBox() {
  const box = { count: 1 };
  try {
    return box;
  } finally {
    box.count = 2;
  }
}
 
console.log(getCount());
console.log(getBox().count);

The answer

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

Checking your sign-in…