Posts

Showing posts from October, 2016

async promises in a sync way?

This blog post title is pretty confusing - but if you get to read this blog post by Google, it actually makes sense. It's actually pretty cool. Not that I don't like callbacks or promises, but I can see this being useful in more complex examples. async function fetchDogPics(url) {   try {     //this looks synchronous but it isn't...     const response = await fetch(url);     await response.text();   } catch (err) {     console.log('failed', err);   } }

Enums in Javascript

Found this tiny library that implements Enums in JavaScript: https://github.com/rauschma/enumify npm install enumify