How can I pass a parameter to a setTimeout() callback? | Example

You can pass arguments to the function inside setTimeout function.

Here is the syntax to pass a parameter to setTimeout() callback. The arg1, arg2, and arg3 are the arguments passed to the function.

The “setTimeout” receives a parameter that is sent as parameter in function end.

Pass parameter to setTimeout callback function example code

HTML example code of pass a parameter to a setTimeout() callback:-

1000 ms = 1 sec

We set 2 parameter you can set only one or all three.


How can I pass a parameter to a setTimeout callback

Do comment if you have any doubts and suggestion on this JS function topic.

Note: All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.