JSFiddle - React, Tailwind, and code Playground

by Eugen Sunic

JavaScript

promise = (val) => new Promise(res => setTimeout(() => {
  console.log(val)
  res(val)
}, 5000));

(async () => {
  years = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  for (iter = 0; iter <= years.length; iter++) {
    await promise(iter);
  }
})()