Skip to content

Instantly share code, notes, and snippets.

@kharissulistiyo
Last active August 29, 2015 14:01
Show Gist options
  • Save kharissulistiyo/146a6440b039b90cf8ef to your computer and use it in GitHub Desktop.
Save kharissulistiyo/146a6440b039b90cf8ef to your computer and use it in GitHub Desktop.
Synchronous vs Asynchronous
// 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