Map and Filter
map and filter are powerful methods for transforming arrays without modifying the original.
Array map()
Creates a new array by transforming each element:
Loading JavaScript Playground...
Array filter()
Creates a new array with elements that pass a test:
Loading JavaScript Playground...
Chaining map and filter
Loading JavaScript Playground...
Working with Objects
Loading JavaScript Playground...
Exercise: Square Numbers
Use map to square all numbers in an array:
Loading JavaScript Exercise...
Exercise: Filter Positives
Filter out negative numbers:
Loading JavaScript Exercise...
Up next · Lesson 26 of 37
Reduce
1 min read
25 of 37 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

