cf.completefrontend

Predict the outputHard

What does this log when you call a bound constructor with and without new?

What does this log?
function Point(x, y) {
  this.x = x;
  this.y = y;
}
 
const target = { x: 0, y: 0 };
const BoundPoint = Point.bind(target, 1);
 
const p = new BoundPoint(2);
console.log(p.x, p.y);
console.log(target.x);
console.log(p instanceof Point, p instanceof BoundPoint);
 
BoundPoint(5);
console.log(target.x, target.y);

The answer

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

Checking your sign-in…