Skip to content

Instantly share code, notes, and snippets.

@kopylovvlad
Last active April 30, 2017 12:40
Show Gist options
  • Select an option

  • Save kopylovvlad/556d920e98dc226b6b8bda593e559296 to your computer and use it in GitHub Desktop.

Select an option

Save kopylovvlad/556d920e98dc226b6b8bda593e559296 to your computer and use it in GitHub Desktop.
'use strict'
const _loadDataForUser = (url, callback) => {
setTimeout(callback, 2 * 1000)
}
const loadDataForUsers = (userNames) => {
for (var i in userNames) {
_loadDataForUser(`users/${userNames[i]}`, function () {
console.log('Fetching for ', userNames[i])
})
}
}
loadDataForUsers(['John', 'Eve', 'Oleg'])
// Fetching for Oleg
// Fetching for Oleg
// Fetching for Oleg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment