Skip to content

Instantly share code, notes, and snippets.

@kopylovvlad
Created April 30, 2017 12:14
Show Gist options
  • Select an option

  • Save kopylovvlad/25677ced505d01808522c7ad0c062877 to your computer and use it in GitHub Desktop.

Select an option

Save kopylovvlad/25677ced505d01808522c7ad0c062877 to your computer and use it in GitHub Desktop.
'use strict'
const _loadDataForUser = (url, callback) => {
setTimeout(callback, 2 * 1000)
}
const loadDataForUsers = (userNames) => {
for (let i in userNames) {
_loadDataForUser(`users/${userNames[i]}`, function () {
console.log('Fetching for ', userNames[i])
})
}
}
loadDataForUsers(['John', 'Eve', 'Oleg'])
// Fetching for John
// Fetching for Eve
// Fetching for Oleg
const COUNT = 4
// const COUNT = 2 raise SyntaxError: Identifier 'COUNT' has already been declared
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment