Predict Filtered List
Predict Output Medium
Question
How many <li> elements render?
Code
const numbers = [1, 2, 3, 4, 5, 6];
<ul>
{numbers
.filter(n => n % 2 === 0)
.map(n => <li key={n}>{n}</li>)}
</ul>
Hint
First filter to even numbers, then count.
Explanation
The filter keeps only even numbers: [2, 4, 6]. That's 3 items, so 3 <li> elements render.
Related Resources
Related Lessons
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.