diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcfb..ba66359c15 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

+

Quote Generator

diff --git a/Sprint-3/quote-generator/package.json b/Sprint-3/quote-generator/package.json index 0f6f989174..00c9212370 100644 --- a/Sprint-3/quote-generator/package.json +++ b/Sprint-3/quote-generator/package.json @@ -14,4 +14,4 @@ "url": "https://github.com/CodeYourFuture/CYF-Coursework-Template/issues" }, "homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme" -} +} \ No newline at end of file diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b722..44cfe0481a 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -491,3 +491,20 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote +function getRandomQuote() { + return pickFromArray(quotes); +} + +function displayQuote() { + const quoteEl = document.querySelector("#quote"); + const authorEl = document.querySelector("#author"); + const quoteObj = getRandomQuote(); + quoteEl.innerText = quoteObj.quote; + authorEl.innerText = quoteObj.author; +} + +displayQuote(); + +const buttonEl = document.querySelector("#new-quote"); + +buttonEl.addEventListener("click", displayQuote);