<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <title>Recursive setTimeout() example</title>
  </head>
  <body>
    <script>
      let i = 1;

      setTimeout(function run() {
       console.log(i);
       i++;
       setTimeout(run, 100);
      }, 100);

      // Do the same thing using setInterval()
      // setInterval(function run() {
      //  console.log(i);
      //  i++
      // }, 100);
    </script>
  </body>
</html>
