Window setTimeout() Method - Use "named" function in setTimeout() - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window setTimeout

Description

Window setTimeout() Method - Use "named" function in setTimeout()

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials