From dc304c5f6150da6ccb891b6da1803e853b8a0a59 Mon Sep 17 00:00:00 2001 From: Diane Vail Date: Wed, 11 Dec 2024 20:30:29 -0500 Subject: [PATCH 1/2] webdev-counter-challenge --- css/style.css | 6 ++++++ js/app.js | 11 ++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/css/style.css b/css/style.css index c10d2b4..9bae5ab 100644 --- a/css/style.css +++ b/css/style.css @@ -66,4 +66,10 @@ body { } @media (width >= 500px) { + .app-card { + display: flex; + flex-direction: row; + max-width: 500px; + flex: 1; + } diff --git a/js/app.js b/js/app.js index db2cc94..fdd770c 100644 --- a/js/app.js +++ b/js/app.js @@ -1,4 +1,4 @@ -"using strict"; +"use strict"; let count = 0; @@ -9,20 +9,17 @@ const decrementBtn = document.querySelector(".decrement-btn"); function incrementCount() { - // Write the relevant code in this block - + count ++; //increase count by 1 } function decrementCount() { - // Write the relevant code in this block - + count --; //decrease count by 1 } function resetCount() { - // Write the relevant code in this block - + count = 0; //reset counter to 0 } function renderUpdatedCount() { From dec80425e7909ffb944668edfeb803242314b68d Mon Sep 17 00:00:00 2001 From: Diane Vail Date: Sun, 15 Dec 2024 15:28:12 -0500 Subject: [PATCH 2/2] webdev-counter-challenge --- css/style.css | 4 ++-- js/app.js | 23 +++++------------------ quiz.txt | 10 +++++++++- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/css/style.css b/css/style.css index 9bae5ab..04a557d 100644 --- a/css/style.css +++ b/css/style.css @@ -71,5 +71,5 @@ body { flex-direction: row; max-width: 500px; flex: 1; - -} + } +} \ No newline at end of file diff --git a/js/app.js b/js/app.js index fdd770c..6c0377f 100644 --- a/js/app.js +++ b/js/app.js @@ -9,12 +9,12 @@ const decrementBtn = document.querySelector(".decrement-btn"); function incrementCount() { - count ++; //increase count by 1 + ++ count; //increase count by 1 } function decrementCount() { - count --; //decrease count by 1 + -- count; //decrease count by 1 } @@ -27,32 +27,19 @@ function renderUpdatedCount() { } incrementBtn.addEventListener("click", function () { - // Write code below this line - - - - // STOP HERE - + ++ count; renderUpdatedCount(); }); resetBtn.addEventListener("click", function () { - // Write code below this line - - - // STOP HERE - + count = 0; renderUpdatedCount(); }); decrementBtn.addEventListener("click", function () { - // Write code below this line - - - // STOP HERE - + --count; renderUpdatedCount(); }); diff --git a/quiz.txt b/quiz.txt index 86fee07..049f196 100644 --- a/quiz.txt +++ b/quiz.txt @@ -1,5 +1,13 @@ 1. Why do you use "using strict" at the top of your JS files? +It helps write cleaneer code and catch mistakes faster. + 2. What does line 3 mean? +It sets the initial count to zero + 3. What is happening on lines 5-8 and why? +Creates variables , then goes to teh HTML code and looks for an element with the same + class as stated. It then stores them in the variables. + 4. If you implemented the functionality of the buttons, - why do you think I wrote the JS code the way I did? \ No newline at end of file + why do you think I wrote the JS code the way I did? + I don't really know...Maybe for readability? \ No newline at end of file