A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-159.js
1functiongreet(g){returng+", "+this.name;}
2constbound=greet.bind({name:"Ada"});
3console.log(bound("Hi"));
Scope
Answer & explanation
Console output
Hi, Ada
Why
Function.prototype.bind returns a new function whose this is permanently set to the first argument, here {name:"Ada"}. Later arguments to the bound function are still passed through normally, so bound("Hi") supplies g = "Hi" while this.name resolves to "Ada". Binding the receiver up front is a common way to lock a method to a specific object before passing it as a callback.