cf.completefrontend

Predict the outputMedium

What does map return here, with and without its second argument?

What does this log?
const scaler = {
  factor: 3,
  scale(numbers) {
    return numbers.map(function (n) {
      return n * this.factor;
    });
  },
  scaleWithThisArg(numbers) {
    return numbers.map(function (n) {
      return n * this.factor;
    }, this);
  },
};
 
console.log(scaler.scale([1, 2]));
console.log(scaler.scaleWithThisArg([1, 2]));

The answer

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

Checking your sign-in…