Last active
October 8, 2021 05:05
-
-
Save mathiasgheno/73353b86919fd8b662b07d9a2a2fe370 to your computer and use it in GitHub Desktop.
AsyncForEach.js
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 fetch = require('node-fetch'); | |
const getAvatarURLFromUser = async (user) => { | |
const res = await fetch(`https://api.github.com/users/${user}`); | |
const data = await res.json(); | |
return data.avatar_url; | |
} | |
let arrayUsers = ['MathiasGheno', 'sindresorhus', 'tj']; | |
arrayUsers.forEach(async user => { | |
const avatar_url = await getAvatarURLFromUser(user); | |
console.log(avatar_url); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment