Skip to content

Instantly share code, notes, and snippets.

@samzhao
Created June 30, 2018 03:39
Show Gist options
  • Select an option

  • Save samzhao/8834c9f8f7350a68ba21c6daf3dc93c7 to your computer and use it in GitHub Desktop.

Select an option

Save samzhao/8834c9f8f7350a68ba21c6daf3dc93c7 to your computer and use it in GitHub Desktop.

Revisions

  1. samzhao created this gist Jun 30, 2018.
    9 changes: 9 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    const delay = time =>
    new Promise(resolve => setTimeout(resolve, time));

    const list = new Array(10).fill();

    list.forEach(async (_, index) => {
    await delay(1000);
    console.log(index);
    });