0 votes
in JavaScript by
What is the use of setTimeout in Javascript?

1 Answer

0 votes
by

The setTimeout() method is used to call a function or evaluate an expression after a specified number of milliseconds. For example, let's log a message after 2 seconds using setTimeout method,

setTimeout(function () {
  console.log("Good morning");
}, 2000);
...