Skip to content

bind()

bind() creates a new function with this permanently set to the provided value. The new function can be called later, optionally with preset arguments.

const boundGreet = greet.bind(person, "Marseille");
boundGreet("France"); // Alice lives in Marseille, France