Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- setTimeout(myFunction, 3000);// if you have defined a function named myFunction it will run after 3 seconds (3000 milliseconds)
- function test1()
- {
- //some code
- //Let's say JS did have a sleep function.
- sleep(3000); //sleep for 3 seconds,
- alert('hi');
- }
- function test2()
- {
- setTimeout(function() { alert('hello');}, 3000); //defer the execution of anonymous function for 3 seconds and go to next line of code.
- alert('hi');
- }
Add Comment
Please, Sign In to add comment