cf.completefrontend

Predict the outputMedium

Can call or bind change the this of an arrow function? What does this log?

What does this log?
var who = "window";
 
const arrow = () => this.who;
const obj = { who: "obj" };
 
console.log(arrow.call(obj));
console.log(arrow.bind(obj)());
 
function makeArrow() {
  return () => this.who;
}
 
console.log(makeArrow.call(obj)());
console.log(makeArrow()());

The answer

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

Checking your sign-in…