We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c079ba2 commit 6ffb055Copy full SHA for 6ffb055
Sprint-3/quote-generator/quotes.js
@@ -491,3 +491,19 @@ const quotes = [
491
];
492
493
// call pickFromArray with the quotes array to check you get a random quote
494
+const fetchQuote = document.getElementById("quote");
495
+const fetchAuthor = document.getElementById("author");
496
+const newQuote = document.getElementById("new-quote");
497
+
498
+// function to display a random quote
499
+function displayRandomQuote() {
500
+ const randomQuote = pickFromArray(quotes);
501
+ fetchQuote.innerText = randomQuote.quote;
502
+ fetchAuthor.innerText = randomQuote.author;
503
+}
504
505
+// show one quote when page loads
506
+displayRandomQuote();
507
508
+// change quote when button is clicked
509
+newQuote.addEventListener("click", displayRandomQuote);
0 commit comments