Created
April 30, 2017 12:14
-
-
Save kopylovvlad/25677ced505d01808522c7ad0c062877 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 (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