Pp commited on
Commit
a3134cc
·
verified ·
1 Parent(s): 7cde207

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +14 -6
index.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
- <title>📝 Area & Perimeter Adventure 📐</title>
7
  <link rel="stylesheet" href="style.css" />
8
  </head>
9
  <body>
@@ -16,7 +16,15 @@
16
  <button id="reset-grid">🔄 Reset</button>
17
  </div>
18
 
19
- <div class="grid-and-stats">
 
 
 
 
 
 
 
 
20
  <div class="grid-wrapper">
21
  <div class="grid" id="grid"></div>
22
  </div>
@@ -75,10 +83,10 @@
75
 
76
  filledCells.forEach(index => {
77
  const i = parseInt(index);
78
- if (!filledCells.has((i - gridSize).toString())) perimeter++; // top
79
- if (!filledCells.has((i + 1).toString()) || i % gridSize === gridSize - 1) perimeter++; // right
80
- if (!filledCells.has((i + gridSize).toString())) perimeter++; // bottom
81
- if (!filledCells.has((i - 1).toString()) || i % gridSize === 0) perimeter++; // left
82
  });
83
 
84
  areaDisplay.textContent = area;
 
3
  <head>
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
+ <title>📝 Learning about Area & Perimeter 📐</title>
7
  <link rel="stylesheet" href="style.css" />
8
  </head>
9
  <body>
 
16
  <button id="reset-grid">🔄 Reset</button>
17
  </div>
18
 
19
+ <div class="main-layout">
20
+ <div class="definitions">
21
+ <h2>What’s Area?</h2>
22
+ <p>Area is the number of squares inside a shape. Count all the filled tiles!</p>
23
+
24
+ <h2>What’s Perimeter?</h2>
25
+ <p>Perimeter is the number of edges touching the outside. Like tracing the shape’s border!</p>
26
+ </div>
27
+
28
  <div class="grid-wrapper">
29
  <div class="grid" id="grid"></div>
30
  </div>
 
83
 
84
  filledCells.forEach(index => {
85
  const i = parseInt(index);
86
+ if (!filledCells.has((i - gridSize).toString())) perimeter++;
87
+ if (!filledCells.has((i + 1).toString()) || i % gridSize === gridSize - 1) perimeter++;
88
+ if (!filledCells.has((i + gridSize).toString())) perimeter++;
89
+ if (!filledCells.has((i - 1).toString()) || i % gridSize === 0) perimeter++;
90
  });
91
 
92
  areaDisplay.textContent = area;