From 69e8f2965c75233f2f2727b38341fd50de5fa372 Mon Sep 17 00:00:00 2001 From: Thuan Bui <9248622+10h30@users.noreply.github.com> Date: Mon, 24 Feb 2025 09:10:45 +0900 Subject: [PATCH] Add check grid size smaller than 10 --- script.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/script.js b/script.js index 2f4f760..617741b 100644 --- a/script.js +++ b/script.js @@ -3,10 +3,18 @@ const containerWidth = document.querySelector(".container").clientWidth; console.log(containerWidth) const button = document.querySelector("button") +let size = 0 button.addEventListener('click', () => { - - let gridSize = prompt("Please enter grid size: ") - makeGrid(gridSize) + do { + let gridSize = prompt("Please enter grid size: ") + size = gridSize + console.log(size) + if (size > 100) { + alert("Please enter number smaller than 100") + } + } + while (size > 100); + makeGrid(size) } )