cf.completefrontend

Predict the outputHard

What does this log, given that one function runs in strict mode and the other doesn't?

What does this log?
function sloppy(a) {
  arguments[0] = 99;
  const frozen = Object.freeze({ n: 1 });
  frozen.n = 2;
  return [a, frozen.n];
}
 
function strict(a) {
  "use strict";
  arguments[0] = 99;
  const frozen = Object.freeze({ n: 1 });
  try {
    frozen.n = 2;
  } catch (error) {
    console.log(error.name);
  }
  return [a, frozen.n];
}
 
console.log(sloppy(1));
console.log(strict(1));

The answer

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

Checking your sign-in…