JavaScript · Middle · Question 3 of 75
What does this code print?
function f() { return this.x; }
const g = f.bind({ x: 1 }).bind({ x: 2 });
console.log(g());- ✓Correct answer:
1 - 2
2 - 3
undefined
Explanation
A bound function "remembers" its context forever; a second bind can't change it (though it can add arguments). Only new can override this of a bound function.