copy

Bind

Bind allows us to copy a function. Why would we want to do this? By copying it, we change the context of “this” for the entire new function. Here is an example…

The output would be “George”. This was possible because we used bind to copy the original function to the newAnimal function. This also allowed us to change the “this” context to newAnimalName at the same time.

Happy Coding!

Clay Hess

Share this post

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email
Skip to content