Async/Await in JavaScript

12 June 2017

Async/await is a way to handle asynchronous code in JavaScript. Before async/await the only options were to use callbacks and promises resulting in highly nested structures. The benefit of using async/await is that it creates a cleaner way to structure asynchronous code without having to rely on nested callbacks or confusing promise chains.

Introduction to Fetch in JavaScript

05 June 2017

Instead of using the good old XMLHttp Request Object in JavaScript. ES6 introduce the concept of Fetch. Fetch provides a cleaner interface for retrieving resources from both internal, but also external sources. The interface will seem familiar to the XMLHttpRequest, but Fetch has both a more powerful and flexible feature set.

Generators in JavaScript

29 May 2017

ES6 came with a new type of function called a generator. A generator in JavaScript is a function that can be entered and exited that saves its current state across multiple re-enterings of the function. In this blog post, I will go over how to create a generator and how to use it. In the end of the post, I will show a use-case where a generator function can be applied.

Promises in JavaScript

22 May 2017

In JavaScript, the most common way to retrieve data is though calling an API. Calling an API is in most cases done asynchronously instead of synchronously to create the best user experience and making it possible to call multiple APIs at the same time. The standard way to call an API asynchronous is by using function callbacks. The problem with the function callback is that it is likely to introduce big nested callback chains that can be hard to debug and maintain. The new and superior way to handle asynchronous code is by using promises.

Array methods in JavaScript

15 May 2017

Working with collections are a daily task, as a programmer. JavaScript uses the Array as the main type of collection. In this blog post, I will go over the methods on the array that I find most useful. Hopefully, the introduction to the methods will be increasing your productivity, working with collections and increasing the readability and maintainability of your code.