Member-only story
Javascript data structure with map, reduce, filter, and ES6
If you are a fan of javascript and use it daily, then you will love this 😃

Javascript is a language that gives the freedom of writing code in any style, from imperative to declarative. Most programmers use imperative because either they are coming from OOPs background, maybe they love it, or they are not familiar with other styles. Before we dive into the declarative style which is functional programming (FP), let’s understand the differences between the two by looking at an example (if you already know the difference then you may skip few paragraphs)
Imperative
The imperative style is cool but imagine if there is a complex mathematics logic here then the size of code and the readability will suck. It increases the cognitive load when reading, and over time makes it easier to falter in reasoning and logic.
Also, the main complexity of this code snippet derives from the fact that instead of telling the computer what we want it to do, we are…