Data Structures & Modern Syntax · 9 min read · Beginner
Arrays, Objects & Rendering Lists
Store structured data in arrays of objects and transform them cleanly with .filter() and .map() before rendering to the DOM.
What you'll learn
- Model structured records using JavaScript objects and arrays
- Filter items with .filter() and transform them with .map()
- Render dynamic lists cleanly into the DOM
Most real web apps fetch a list of items (courses, products, messages) as an array of objects, filter or sort it, and render it into HTML.
.filter() + .map() Pipeline
const courses = [
{ title: 'HTML', free: true },
{ title: 'CSS', free: true },
{ title: 'Pro Workshop', free: false },
];
const freeTitles = courses
.filter((c) => c.free)
.map((c) => c.title);
// ['HTML', 'CSS']
Try It Yourself
Click the difficulty filter buttons below, or add a new course object to the courses array in the JS tab:
Dynamic Course Filter
Live Result
Console Output
No console output yet. Try calling console.log(...) in JS.
Check Your Understanding
Score: 0 / 1
1. Which array method returns a new array containing only the elements that pass a test condition?
Study Workspace
Finished this lesson?
Your progress is saved locally in your browser, no account needed.