Last active
April 30, 2017 12:40
-
-
Save kopylovvlad/556d920e98dc226b6b8bda593e559296 to your computer and use it in GitHub Desktop.
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 characters
| '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