We hope you already know the filter, map and reduce

  1. filter (Extract subset of the array)
  2. map (To iterate array)
  3. reduce ( To get single value from the array i.e sum of the array)

Following Example demonstrate how to extract the negative integers or numbers from the array using Javascript, Node.JS

In the example, We have used filter to extract the negative numbers.


negativeNumbers = numbers.filter(n => n <0);

If n is less than 0 it will return you the filter array [ -15, -8 ]

if you run the following example you will get


Written by

We teach & develop for startups

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store