Answers for "what is settimeout function in javascript"

150

javascript settimeout

setTimeout(function(){
 	alert("Sup!"); 
}, 2000);//wait 2 seconds
Posted by: Guest on June-27-2019
6

set timeout javascript

setTimeout( () => {
 	alert("J'aime les chats"); 
}, 2000);//wait 2 seconds
Posted by: Guest on March-06-2021
5

settimeout

// Run anonymous function after 5,000 milliseconds (5 seconds)
setTimeout(() => {
	// Run code
}, 5000);
Posted by: Guest on February-11-2021
4

javascript settimeout

// Redirect to index page after 5 sec
setTimeout(function(){ window.location="index"; },5000);
Posted by: Guest on July-17-2020
-2

javascript this in settimeout

function func() {
  this.var = 5;
  
  this.changeVar = function() {
    setTimeout(() => { //Don't use function, use arrow function so 'this' refers to 'func' and not window
      this.var = 10;
    }, 1000);
  }
}

var a = new func();
a.changeVar();
Posted by: Guest on May-20-2020

Code answers related to "what is settimeout function in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language