Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to let a function execute after 5 seconds javascript

setTimeout(function() {
           //whatever you want to execute
           }, amountOfSeconds * 1000); //executes after amountOfSeconds seconds

//with defined function
setTimout(functionName, amountOfSeconds * 1000);

//example
setTimeout(function() {
           console.log("It has been 3 seconds.");
           }, 3000);
 
PREVIOUS NEXT
Tagged: #function #execute #seconds #javascript
ADD COMMENT
Topic
Name
7+6 =