JavaScript setTimeout method

setTimeout method is a method of window object which is use to execute a statement or statements or call a function after certain time. Mainly setTimeout method required two arguments first is expression which you want to execute and second argument required time in milliseconds. After the time you will pass as an argument your first argument which is also a JavaScript statement will be executed. Syntax


setTimeout(expression, millisecond);
Example

setTimeout('alert("Hello world")', 5000);
In above mentioned example ‘Hello world’ alert message will appear on the screen after five seconds.