1. Modern Functional Array Iteration
ES6 iterators replace verbose for-loops with clean, declarative operations:
βHTML5 Web Code (index.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JS Map & Filter Studio</title>
</head>
<body style="background:#17181c; color:#fff; font-family:Arial; padding:30px;">
<h2>Course Prices Filtered</h2>
<div id="results"></div>
<script>
const courses = [
{ name: "HTML5 Mastery", price: 0, level: "Beginner" },
{ name: "CSS Grid & Flex", price: 0, level: "Beginner" },
{ name: "Advanced React", price: 0, level: "Advanced" }
];
// Map into HTML pills
const pills = courses.map(c =>
`<span style="display:inline-block; padding:6px 12px; margin:4px; background:#1f2029; border:1px solid #04AA6D; border-radius:6px; color:#fff;">
${c.name} - ${c.price === 0 ? "FREE" : "$" + c.price}
</span>`
).join("");
document.getElementById("results").innerHTML = pills;
</script>
</body>
</html>
