Skip to content

Instantly share code, notes, and snippets.

View zed-dz's full-sized avatar
🚀
Open-Source Collaborations

Amine Hammou zed-dz

🚀
Open-Source Collaborations
  • Code Talk
  • All over the place
View GitHub Profile
@wesbos
wesbos / async-await.js
Created February 22, 2017 14:02
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}