Image for post
Image for post
Jan Erik Waider

As humans, we crave for the connection of others, whether we realize it or not. As writers and content creators people want attention, they want to be noticed. At some point along the way many of us lost the desire to output authentic content, we stopped telling stories from the heart. Instead we began selling stories. We try to provide a catchy title in order to grab a potential reader’s attention, yet mostly have no real substance.

A few of my close friends Gabriel Chavez and Franklyn François started writing on Medium. They decided to try and make a difference. They decided to have a voice. They shared their raw thoughts and emotions. They have written on the themes of identity, shame, and about rejection. …

Image for post
Image for post
Rev your Engines!

What’s a Generator?

Generator are special functions that are new with ES6 / EcmaScript2015. Simply put, a Generator is a function whose execution is “pause-able and resume-able” meaning that it is not “run-to-completion”. This allows us to do some really cool things!

But why?

Generators allow us to do some really powerful things. Generators allow expensive computations to be simply split up and maintainable. They give us another way to write synchronous looking JavaScript which is actually asynchronous. Generators pave the way for the future of JavaScript with things like Async/Await.

Let’s learn with examples!

Defining Generators

In order to define a generator function we use the function* syntax, like so:

function* myGenerator1() {...} …

Image for post
Image for post
Promise Flow (

Why Promises?

In the previous Asynchronous Adventure we discussed the idea/pattern of callbacks in JavaScript. The callback pattern is awesome! One of the drawbacks of the callback pattern is in order to handle sequential async behavior this often resorts in a code which becomes harder to read, debug, and maintain. This is often referred to as callback hell.

One way to manage asynchronous behavior that is often considered to be a leveled up version of the callback pattern is the Promise pattern.

A Brief History

Promises are not a new concept. In fact, they have been around since 1976, when the term was first coined.

In the JavaScript world, in the beginning of 2011, Promise concepts were made popular by jQuery Deferred Objects. Deferred Objects are conceptually similar to Promises, but they do not abide by the current ECMAScript 2015 spec for Promises. …

Image for post
Image for post

Incase you missed it, in the last Asynchronous Adventure, I covered Understanding the JavaScript Event Loop. Now let’s move on to the topic of callbacks. We couldn’t start talking about callbacks until we talk about how to define functions in JavaScript.

Image for post
Image for post


In other C-like languages (Java, C#, C++, etc.) you may be familiar with Class’s having methods or functions within their bodies. But in JavaScript Functions are first-class objects. This makes the concept of passing around functions, and invoking functions very simple and intuitive. If you’re new to JavaScript, let’s take a quick look at how we declare functions:


JavaScript is a powerful language that is eating the world of software development. One of the things that differentiates JavaScript from some of the more “traditional” C-like languages, is how it executes code.

For those unfamiliar with JavaScript, it is often described as having a single-threaded, event-driven, and non-blocking I/O model. This jargon-loaded phrase can be a confusing for those unfamiliar with the JavaScript runtime.

I know there are a lot of great examples and analogies of how the Event Loop works with JavaScript (in the Browser, and in Node), so I will try to break it down in as simply as possible. …


Benjamin Diuguid

Software Engineer @ Google

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store