Skip to content

Commit 4300dcc

Browse files
committed
Quote generator implement
1 parent d9fa42f commit 4300dcc

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎Sprint-3/quote-generator/quotes.js‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,4 +490,19 @@ const quotes = [
490490
},
491491
];
492492

493+
function updateUI(quoteObject) {
494+
let quoteParagraph = document.getElementById("quote");
495+
quoteParagraph.innerText = quoteObject.quote;
496+
let authorParagraph = document.getElementById("author");
497+
authorParagraph.innerText = quoteObject.author;
498+
}
499+
493500
// call pickFromArray with the quotes array to check you get a random quote
501+
let randomQuote = pickFromArray(quotes);
502+
updateUI(randomQuote);
503+
504+
const button = document.getElementById("new-quote");
505+
button.addEventListener("click", () => {
506+
const newQuoteObject = pickFromArray(quotes);
507+
updateUI(newQuoteObject);
508+
});

0 commit comments

Comments
 (0)