Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,20 @@ const quotes = [
];

// call pickFromArray with the quotes array to check you get a random quote
function displayRandomQuote() {
const quoteP = document.getElementById("quote");
const authorP = document.getElementById("author");

const selectedQuote = pickFromArray(quotes);

quoteP.textContent = selectedQuote.quote;
authorP.textContent = selectedQuote.author;
}

// Setup event listener and display initial quote on load
window.addEventListener("DOMContentLoaded", () => {
displayRandomQuote();

const newQuoteBtn = document.getElementById("new-quote");
newQuoteBtn.addEventListener("click", displayRandomQuote);
});
Loading