JavaScript Window setTimeout()
JavaScript Window setTimeout()
The setTimeout() method is used to call a function after a number of milliseconds. It will only call once and will not repeat like in setInterval(). For your information, 1000 milliseconds = 1 second.
Syntax:-
Its syntax is:- setTimeout(function, milliseconds, param1, ...)
Return:-
Its return is:- id of the timer in number which can be used with clearTimeout(id) to cancel the timer
Further Explanation:-
Parameter | Description |
function | Required. The function to execute. |
milliseconds | Optional. The number of milliseconds to wait before executing. |
param1, ... | Optional. Parameters to pass to the function. |