Exercise Level: IntermediateDuration: 30 minLanguage: JavaScript
Array Methods Workout
Ten practical tasks that drill map, filter, reduce, sort and flatMap against realistic data.
Abhishek Sharma 2026-08-11 Programming / JavaScript
Setup
You are given an array of order objects with id, customer, total and status fields.
Tasks
- Return only shipped orders.
- Compute revenue for each customer.
- Find the highest-value order without mutating the source array.
- Group orders by status.
- Produce a flat list of line items across all orders.
Rules
Prefer pure functions. Avoid for loops unless the task explicitly benefits from early exit.
Want more like this?
Browse every exercises in the library, organised by topic.
Related learning
Tutorial
Data Types
Deep dive into JavaScript data types: numbers, strings, arrays, and array methods
Programming / JavaScript
JavaScriptData Types
Tutorial
An Introduction to JavaScript
Learn what JavaScript is, its history, and how to get started with tools and the developer console
Programming / JavaScript
JavaScriptProgramming
Tutorial
JavaScript Fundamentals
Master the basics: Hello World, code structure, variables, data types, and type conversions
Programming / JavaScript
JavaScriptProgramming