• setTimeout: It allows us to run a function after the interval of time.
  • setInterval: It allows us to run a function repeatedly, starting after the interval of time, then repeating again and again continuously at that interval.

These methods are not part of JavaScript specification. These methods are provided by most environments that have an internal scheduler.

BY Best Interview Question ON 18 Aug 2022

Example

setTimeout(() => alert("JavaScript Interview Questions"), 3000); // setTimeout
setInterval(() => alert("JavaScript Interview Questions"), 3000); // setInterval

Suggest An Answer