From eb1098b4c8c208a333d3e9554d2e69202fc933f6 Mon Sep 17 00:00:00 2001 From: yazansedih Date: Thu, 6 Jun 2024 20:37:16 +0300 Subject: [PATCH] clear panel at first. --- js/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/js/index.js b/js/index.js index 2dd348b..0ae758a 100644 --- a/js/index.js +++ b/js/index.js @@ -18,9 +18,23 @@ document.addEventListener("DOMContentLoaded", () => { let remainingCapacity = trucks.map((truck) => truck.capacity); let remainingPoints; +<<<<<<< Updated upstream let deliveryPoints = JSON.parse(localStorage.getItem("deliveryPoints")) || []; localStorage.removeItem("deliveryPoints"); deliveryPoints = []; +======= + deliveryPoints = []; + while (panel.firstChild) { + panel.removeChild(panel.firstChild); + } + localStorage.removeItem("deliveryPoints"); + + const savedPoints = JSON.parse(localStorage.getItem("deliveryPoints")); + if (savedPoints) { + deliveryPoints = savedPoints; + displayDeliveryPoints(); + } +>>>>>>> Stashed changes panel.addEventListener("click", (event) => { const weight = parseFloat(weightInput.value);