-
-
Save Balestrino/37a1c4717f5435540a677a2d219da1c8 to your computer and use it in GitHub Desktop.
Revisions
-
atinux revised this gist
Jun 12, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ const waitFor = (ms) => new Promise(r => setTimeout(r, ms)) const asyncForEach = async (array, callback) => { for (let index = 0; index < array.length; index++) { await callback(array[index], index, array) } -
atinux created this gist
Oct 5, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ const waitFor = (ms) => new Promise(r => setTimeout(r, ms)) const asyncForEach = (array, callback) => { for (let index = 0; index < array.length; index++) { await callback(array[index], index, array) } } const start = async () => { await asyncForEach([1, 2, 3], async (num) => { await waitFor(50) console.log(num) }) console.log('Done') } start()