From 0b3e42b8c37068c5ca91f2d35c6ff63170b96160 Mon Sep 17 00:00:00 2001 From: joanne342 <130585013+joanne342@users.noreply.github.com> Date: Mon, 13 Jul 2026 12:54:39 +0100 Subject: [PATCH 1/4] Update index.html --- 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..f7ad48f79 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,11 +3,11 @@ - Title here + Quote generator -

hello there

+

Quote generator

From 9702a1342e0fa31a56c5fb593654791bd7e28bec Mon Sep 17 00:00:00 2001 From: joanne342 <130585013+joanne342@users.noreply.github.com> Date: Mon, 13 Jul 2026 14:20:07 +0100 Subject: [PATCH 2/4] Update quotes.js --- Sprint-3/quote-generator/quotes.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..e1db791cd 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -1,3 +1,28 @@ +const quoteElem = document.getElementById("quote"); +const authorElem = document.getElementById("author"); +const newQuoteBtn = document.getElementById("new-quote"); + +function getRandomQuote() { + return pickFromArray(quotes); +} + +function displayQuote(quote) { + quoteElem.textContent = quote.quote; + authorElem.textContent = quote.author; +} + +function showRandomQuote() { + const quote = getRandomQuote(); + displayQuote(quote); +} + +function setup() { + newQuoteBtn.addEventListener("click", showRandomQuote); + showRandomQuote(); +} + +window.addEventListener("load", setup); + // DO NOT EDIT BELOW HERE // pickFromArray is a function which will return one item, at From 916447b973f2344b3430f9a2793c4c55849340d2 Mon Sep 17 00:00:00 2001 From: joanne342 <130585013+joanne342@users.noreply.github.com> Date: Tue, 14 Jul 2026 05:02:59 +0100 Subject: [PATCH 3/4] Update quotes.js --- Sprint-3/quote-generator/quotes.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index e1db791cd..6e0e27a9a 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -12,16 +12,11 @@ function displayQuote(quote) { } function showRandomQuote() { - const quote = getRandomQuote(); - displayQuote(quote); + displayQuote(getRandomQuote()); } -function setup() { - newQuoteBtn.addEventListener("click", showRandomQuote); - showRandomQuote(); -} - -window.addEventListener("load", setup); +newQuoteBtn.addEventListener("click", showRandomQuote); +showRandomQuote(); // DO NOT EDIT BELOW HERE From 24a446368a38f1e7077d2679973ce4959a8b9672 Mon Sep 17 00:00:00 2001 From: joanne342 <130585013+joanne342@users.noreply.github.com> Date: Tue, 14 Jul 2026 05:09:52 +0100 Subject: [PATCH 4/4] Update quotes.js --- Sprint-3/quote-generator/quotes.js | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 6e0e27a9a..63c370509 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -1,23 +1,3 @@ -const quoteElem = document.getElementById("quote"); -const authorElem = document.getElementById("author"); -const newQuoteBtn = document.getElementById("new-quote"); - -function getRandomQuote() { - return pickFromArray(quotes); -} - -function displayQuote(quote) { - quoteElem.textContent = quote.quote; - authorElem.textContent = quote.author; -} - -function showRandomQuote() { - displayQuote(getRandomQuote()); -} - -newQuoteBtn.addEventListener("click", showRandomQuote); -showRandomQuote(); - // DO NOT EDIT BELOW HERE // pickFromArray is a function which will return one item, at @@ -511,3 +491,23 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote + +const quoteElem = document.getElementById("quote"); +const authorElem = document.getElementById("author"); +const newQuoteBtn = document.getElementById("new-quote"); + +function getRandomQuote() { + return pickFromArray(quotes); +} + +function displayQuote(quote) { + quoteElem.textContent = quote.quote; + authorElem.textContent = quote.author; +} + +function showRandomQuote() { + displayQuote(getRandomQuote()); +} + +newQuoteBtn.addEventListener("click", showRandomQuote); +showRandomQuote();