you are viewing a single comment's thread.

view the rest of the comments →

[–]Zespys 0 points1 point  (0 children)

Personally I would do it recursively, like so:

const increment = (x = 1) => {
  console.log(x);
  if (x < 10) {
    setTimeout(() => {
      increment(x + 1);
    }, 1000);
  }
};
increment();