June 21, 2020

How to pass a parameter to an event handler or callback?

You can use an arrow function to wrap around an event handler and pass parameters:

This is an equivalent to calling .bind:

Apart from these two approaches, you can also pass arguments to a function which is defined as array function