Partial Application made easy with ES6

In this post I will present a quick example on how ES6 can improve readability and help build code that is easier to maintain.

Also, I will be exploring partial application, a nice technique to keep in your developer toolbox.

Continue reading “Partial Application made easy with ES6”

Javascript as Promised

Promises have been there for a while now, officially released in ES6 but already being supported by most browsers before that and/or polyfiled by libraries.
They are a game changer in Javascript, helping to make our code more functional and in result easier to maintain and read.

As Martin Fowler defined them, “Promises are objects which represent the pending result of an asynchronous operation”.

Continue reading “Javascript as Promised”

Callbacks in Javascript

Any usual function call in Javascript is considered a synchronous call. The engine will get to that line, call that function and wait for it to get resolved. When that gets resolved it will continue to the next line. Consider the following example:

function increment(a) {
   return a;
Const a = 0;
a = increment(a); // 1
a = increment(a); // 2

In the previous example, when the engine gets to the first increment, it will wait for the function to be resolved in order to continue to the next call.

Continue reading “Callbacks in Javascript”