DEV Community

 Rahul Gupta
Rahul Gupta

Posted on

Use of setTimeout method in Javascript

The setTimeout() method is used to call a function or evaluate an expression after a specified number of milliseconds.

An example of code below will log a message after 2 seconds using setTimeout method:

setTimeout(function () {
console.log("The Coding Dev");
}, 2000);

Top comments (0)