Your files never leave your device
Advertisement

Map, Filter, Reduce

These three array methods are essential for working with data. They process arrays without mutating the original.

Map (Transform)

Creates a new array by applying a function to every element.

Try It Yourself

        

Filter (Select)

Creates a new array containing only elements that pass a test condition.

Try It Yourself

        

Reduce (Accumulate)

Reduces an array to a single value (like a sum or a single object).

Try It Yourself

        

Practice

Challenge 1: Use filter to keep only even numbers from an array: [1, 2, 3, 4, 5].

Related Guides

Sponsored Utility
While You're Here
Sponsored Recommendations
Advertisement