diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..e761f3554 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,11 +3,10 @@ - Title here + Quote generator app -

hello there

diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..97667b4b3 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -490,4 +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) { + quoteParagraph.innerText = quoteObject.quote; + authorParagraph.innerText = quoteObject.author; +} + +button.addEventListener("click", () => { + showRandomQuote(); +}); +showRandomQuote();