From 275d64585e863914f31ea22ec475bae4c7a839b6 Mon Sep 17 00:00:00 2001 From: Renzo <6025850@mborijnland.nl> Date: Wed, 13 Mar 2024 13:33:39 +0100 Subject: [PATCH] plantenClass OOP werkt volledig met sample data en if statement fix --- src/js/planten.class.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/planten.class.js b/src/js/planten.class.js index fd13610..b671e08 100644 --- a/src/js/planten.class.js +++ b/src/js/planten.class.js @@ -72,10 +72,11 @@ class PlantGrid { "id": 9, "plantNaam": "yippie", "plantensoort": "Groente", - "plantGeteelt": 1 + "plantGeteelt": 0 } ]; + // Only save objects that have plantGeteelt as 1 const filteredData = dataHardObject.filter(plantObject => plantObject.plantGeteelt === 1); // Populate the grid with plant objects @@ -114,7 +115,7 @@ class PlantGrid { td.appendChild(article); itemCount++; - } else if (rowIndex === this.rows -1 && colIndex === this.cols -1 & itemCount <= 7) { + } else if (rowIndex === this.rows -1 && colIndex === this.cols -1 && itemCount <= 7) { // Handle the "Add" button const article = document.createElement("article"); const img = article.appendChild(document.createElement("img"));