What is binding in JavaScript?
Jan 24, 2021
In JavaScript the bind() method creates a new function and sets this to a specific value.
For instance, here we have a simple object:
Then we use the bind() method to set the context of this to the person object:
When it is all done and the function is invoked it will look like this: