Common algorithms

map()

map() applies a function to each value of a range and returns the results of applying that function.

map(["apple", "orange", "peach"], (item) => item.length)

filter()

filter() applies a predicate to each value of a range and filters out the values for which the predicate is false.

filter(["apple", "orange", "peach"], (item) => item.length == 5)

reduce()

reduce() combines the values of a range using a given function and returns a single value.

reduce(["apple", "orange", "peach"], "", (acc, item) => acc + item)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.174.248