From 346da3f39a059dc59bd6d150fac1daa657a2ddd3 Mon Sep 17 00:00:00 2001 From: Xi Xu Date: Thu, 28 Nov 2024 22:45:02 +0800 Subject: [PATCH] Update script.js --- script.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/script.js b/script.js index 47c1a9d..a488253 100644 --- a/script.js +++ b/script.js @@ -267,3 +267,17 @@ function updateComparisonTable(algorithm, totalSeekTime, order) { row.cells[1].textContent = totalSeekTime; row.cells[2].textContent = order.join(" → "); } + +function resetComparisonTable() { + algorithmHistory = { + fcfs: { seekTime: "-", order: [] }, + sstf: { seekTime: "-", order: [] }, + scan: { seekTime: "-", order: [] }, + }; + + ["fcfs", "sstf", "scan"].forEach((algorithm) => { + const row = document.getElementById(`${algorithm}Row`); + row.cells[1].textContent = "-"; + row.cells[2].textContent = "-"; + }); +}