Javascript examples for Browser Object Model:Window setTimeout
Window setTimeout() Method - Use "named" function in setTimeout()
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> var myVar;/* w w w . jav a2 s.c o m*/ function myFunction() { myVar = setTimeout(alertFunc, 3000); } function alertFunc() { console.log("Hello!"); } </script> </body> </html>