Q9.webp
L

Q9.webp

Kizspy | Question: 9
(Choose 1 answer)
How would you combine filter() and map() to display only fruits with names longer than 5 characters and
transform them into uppercase?
A. const items = ["Apple", "Banana", "Cherry", "Avocado"];
return (
<ul>
items.filter(item => item.length > 5).map(item => <li>{item}</li>)
</ul>
);
B. const items = ["Apple", "Banana", "Cherry", "Avocado"];
return(
<ul>
items.filter(item => item.length > 5)
.map(item => <li key={item}>{item.toUpperCase()}</li>)
}
</ul>
);
C. const items = ["Apple", "Banana", "Cherry", "Avocado"];
return (
<ul>
{
items.map(item => <li key={item}>{item}</li>).filter(item => item.length > 5)
);
</ul>
D. const items = ["Apple", "Banana", "Cherry", "Avocado"];
return (
<ul>
}
items.map(item => item.toUpperCase()).filter(item => item.length > 5)
</ul>
);

Thông tin

Category
FER202
Thêm bởi
Luffy_san
Ngày thêm
Lượt xem
2,822
Lượt bình luận
7
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom