diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..aaeef90aa 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,13 +3,14 @@ - Title here + Quote generator app -

hello there

-

-

- +

Quote Generator

+

+

+

+ diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..3ae0de846 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -19,7 +19,16 @@ function pickFromArray(choices) { return choices[Math.floor(Math.random() * choices.length)]; } +function showRandomQuote() { + const randomQuote = pickFromArray(quotes); + const quoteText = document.getElementById("quote-text"); + const quoteAuthor = document.getElementById("quote-author"); + quoteText.innerText = `"${randomQuote.quote}"`; + quoteAuthor.innerText = `- ${randomQuote.author}`; +} +window.onload = showRandomQuote; +document.getElementById("new-quote-button").addEventListener("click", showRandomQuote); // A list of quotes you can use in your app. // DO NOT modify this array, otherwise the tests may break! const quotes = [