Last active
August 29, 2015 14:01
-
-
Save kharissulistiyo/146a6440b039b90cf8ef to your computer and use it in GitHub Desktop.
Synchronous vs Asynchronous
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
// Asynchronous | |
var shirt, pants, shoes; | |
var getItem = function (storeName, itemName) { | |
var store = goToStore(storeName); | |
var item = store.getItem(itemName); | |
console.log('I got my ' + itemName); | |
return item; | |
}; | |
shirt = getItem('The Shirt Store', 'shirt'); | |
pants = getItem('The Pants Store', 'pants'); | |
shoes = getItem('The Shoe Store', 'shoes'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment