Javascript filter()

Pawel Grajewski
1 min readApr 12, 2020

When we think about modern sites and how they are structure one of the most important things is the ability to easily integrate, map, and filter in the data queries. One function which allowed us this is filter function. Let’s explain it in a simple example:

In the above example, we can see filter function how we can filter or not which kind of output we want to return.

The basic structure of this method:

array.filter(function(currentValue, index, arr),thisValue)

We can also use the filter as a simple search engine with combine indexOf:

We can also use deconstructor to find many elements with the same properties:

Links to documentation:

--

--