call(), apply(), bind()

🏷️ Javascript

call(): call function, replace this inside the function with the first parameter, the rest parameters are passed to the function as arguments separated by commas

apply(): similar to call() but pass an array of all parameters as arguments to the function

bind(): create a new function and bind this to the first argument, the rest arguments will be passed to the new function when being called


https://medium.com/@omergoldberg/javascript-call-apply-and-bind-e5c27301f7bb

https://www.freecodecamp.org/news/understand-call-apply-and-bind-in-javascript-with-examples/