Example 1 — Official this + Partial
Lock the object and the greeting; pass punctuation later.
function greet(greeting, punctuation) {
return greeting + " " + this.user + punctuation;
}
var object = { user: "fred" };
var bound = _.bind(greet, object, "hi");
bound("!");
// → "hi fred!" How It Works
- thisArg.
objectbecomesthisinsidegreet. - Partial.
"hi"is stored as the first argument. - Call.
bound("!")appends"!"as punctuation. - Result. Same string as the official Lodash docs.

