Skip to content

Commit a6bbeae

Browse files
Complete Quote Generator logic
1 parent debc327 commit a6bbeae

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Sprint-3/quote-generator/quotes.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,16 @@ const quotes = [
491491
];
492492

493493
// call pickFromArray with the quotes array to check you get a random quote
494+
const quoteElement = document.querySelector("#quote");
495+
const authorElement = document.querySelector("#author");
496+
const newQuoteBtn = document.querySelector("#new-quote");
497+
498+
function displayRandomQuote() {
499+
const randomQuote = pickFromArray(quotes);
500+
quoteElement.innerText = randomQuote.quote;
501+
authorElement.innerText = randomQuote.author;
502+
}
503+
504+
displayRandomQuote();
505+
506+
newQuoteBtn.addEventListener("click", displayRandomQuote);

0 commit comments

Comments
 (0)