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 😃

Deepak Gupta
TDS Archive
5 min readMay 13, 2018

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…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Deepak Gupta
Deepak Gupta

Written by Deepak Gupta

COO @Steer Protocol| Write about Blockchain & Javascript | Take it easy

Responses (7)

What are your thoughts?