Last active
September 17, 2019 21:39
-
-
Save ralfting/5701e0184c391a210389e10e62a66a2e to your computer and use it in GitHub Desktop.
This file contains 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 characters
const arr = [1,2,3,4]; | |
let newArr = []; | |
const fetchMock = (item) => | |
new Promise(resolve => setTimeout(() => resolve(item), 500)); | |
function someFunc() { | |
[1,2,3,4].forEach(async (item) => { | |
const result = await fetchMock(item); | |
newArr.push(result); | |
console.log(newArr); | |
}); | |
console.log('me first'); | |
} | |
someFunc() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment