From d9fa42fa4a6c0e7b307f6d1d82935209f989df79 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Mon, 27 Jul 2026 19:11:04 +0100 Subject: [PATCH 1/4] Add script and title --- Sprint-3/quote-generator/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..c9e5c2c33 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,11 +3,11 @@ - Title here + Quote generator app -

hello there

+

Hello there

From 4300dcc28f2beb2927076e2f6f497c56544d1b2c Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Mon, 27 Jul 2026 19:11:33 +0100 Subject: [PATCH 2/4] Quote generator implement --- Sprint-3/quote-generator/quotes.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..92936d296 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -490,4 +490,19 @@ const quotes = [ }, ]; +function updateUI(quoteObject) { + let quoteParagraph = document.getElementById("quote"); + quoteParagraph.innerText = quoteObject.quote; + let authorParagraph = document.getElementById("author"); + authorParagraph.innerText = quoteObject.author; +} + // call pickFromArray with the quotes array to check you get a random quote +let randomQuote = pickFromArray(quotes); +updateUI(randomQuote); + +const button = document.getElementById("new-quote"); +button.addEventListener("click", () => { + const newQuoteObject = pickFromArray(quotes); + updateUI(newQuoteObject); +}); From d9cc099e71759c67d83b77d15193a66a35d4bd18 Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 29 Jul 2026 14:51:52 +0100 Subject: [PATCH 3/4] Removed unnecessary heading --- Sprint-3/quote-generator/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index c9e5c2c33..e761f3554 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -7,7 +7,6 @@ -

Hello there

From 12275cc7502158b4a10b3bfca85da67818a3f14c Mon Sep 17 00:00:00 2001 From: dona-shehu Date: Wed, 29 Jul 2026 14:52:57 +0100 Subject: [PATCH 4/4] removed document.getElementById outside the function --- Sprint-3/quote-generator/quotes.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 92936d296..97667b4b3 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -490,19 +490,22 @@ const quotes = [ }, ]; +const quoteParagraph = document.getElementById("quote"); +const authorParagraph = document.getElementById("author"); +const button = document.getElementById("new-quote"); + +// call pickFromArray with the quotes array to check you get a random quote +function showRandomQuote() { + let randomQuote = pickFromArray(quotes); + updateUI(randomQuote); +} + function updateUI(quoteObject) { - let quoteParagraph = document.getElementById("quote"); quoteParagraph.innerText = quoteObject.quote; - let authorParagraph = document.getElementById("author"); authorParagraph.innerText = quoteObject.author; } -// call pickFromArray with the quotes array to check you get a random quote -let randomQuote = pickFromArray(quotes); -updateUI(randomQuote); - -const button = document.getElementById("new-quote"); button.addEventListener("click", () => { - const newQuoteObject = pickFromArray(quotes); - updateUI(newQuoteObject); + showRandomQuote(); }); +showRandomQuote();