Skip to content

Commit 71fb13e

Browse files
committed
Map Method in DOM
1 parent f07de83 commit 71fb13e

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

arrayMethods/map.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Map</title>
8+
</head>
9+
<body>
10+
<h1>Map Method</h1>
11+
<div id="results"></div>
12+
<script>
13+
const results = document.querySelector("#results");
14+
const items = [
15+
{ id: "🍔", name: "Super Burger", price: 150 },
16+
{ id: "🥩", name: "Super Meat", price: 450 },
17+
{ id: "🍜", name: "Super Noodles", price: 180 },
18+
];
19+
const names = items.map(
20+
(item) => `<li>${item.name} - ${item.price} Tk</li>`
21+
);
22+
results.innerHTML = names;
23+
</script>
24+
</body>
25+
</html>

0 commit comments

Comments
 (0)