Pre-recorded question

Question #21
How to use the setTimeout function in JavaScript?
Answer

The standard way to create a delay in JavaScript is to use the setTimeout(callback, ms) method. The first parameter is the callback function, the second one is the duration in milliseconds:

setTimeout(myFunction, 2000);

function myFunction() {
	console.log("End of delay!");
}
This can also be used with anonymous function:

setTimeout( () => { console.log("End of delay!"); }, 2000);

5 events in history
Answer by Alphonsio 05/03/2020 at 08:25:21 AM

The standard way to create a delay in JavaScript is to use the setTimeout(callback, ms) method. The first parameter is the callback function, the second one is the duration in milliseconds:

setTimeout(myFunction, 2000);

function myFunction() {
	console.log("End of delay!");
}
This can also be used with anonymous function:

setTimeout( () => { console.log("End of delay!"); }, 2000);

Answer by Alphonsio 05/03/2020 at 08:25:03 AM

The standard way to create a delay in JavaScript is to use the setTimeout(callback, ms) method. The first parameter is the callback function, the second one is the duration in milliseconds:

setTimeout(myFunction, 2000);

function myFunction() {
	console.log("End of delay!");
}
This can also be used with anonymous function:

setTimeout( () => { console.log("End of delay!"); }, 2000);




Question by Alphonsio 05/03/2020 at 08:07:03 AM
How to use the setTimeout function in JavaScript?
Answer by Alphonsio 05/03/2020 at 08:06:34 AM

The standard way to create a delay in JavaScript is to use the setTimeout(callback, ms) method. The first parameter is the callback function, the second one is the duration in milliseconds:

setTimeout(myFunction, 2000);

function myFunction() {
	console.log("End of delay!");
}
This can also be used with anonymous function:

setTimeout( () => { console.log("End of delay!"); }, 2000);




Question by Alphonsio 05/03/2020 at 08:02:27 AM
How to create a simple delay in JavaScript?
# ID Query URL Count

Icons proudly provided by Friconix.