Javascript Reduce function

Reduce Finally, we come to .reduce(), which, admittedly, is the most confusing of the three methods. The name of the method refers to reducing multiple values to one. However, I found that it’s easier to think of it as building up rather than reducing. The method works by defining a starting point. As the method iterates … Read more

Javascript Filter function

Filter On to the .filter() method, which is used when you want to extract a subset of values from the iterable. When using .filter(), remember that we are filtering in values, not filtering out. This means that each item in the iterable that evaluates true will be included in the filter. Let’s use an example of keeping only … Read more

Map function

Map The .map() method is used when you want to 1. perform a set of statements with every value in the iterable and 2. return the (presumably) modified value. Let’s use a simple example of calculating sales tax on an array of prices. const prices = [19.99, 4.95, 25, 3.50]; let new_prices = [];for(let i=0; i < … Read more