Skip to content

Commit 859ac64

Browse files
Alex JamshidiAlex Jamshidi
authored andcommitted
PR changed made
1 parent d64ad44 commit 859ac64

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

Sprint-3/quote-generator/quotes.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,9 @@ const quotes = [
492492

493493
// call pickFromArray with the quotes array to check you get a random quote
494494

495-
function setup() {
495+
function showNewQuote() {
496496
updateQuote();
497-
appendQuote();
497+
replaceQuote();
498498
}
499499

500500
const state = {
@@ -508,17 +508,15 @@ function updateQuote() {
508508
state.author = chosenQuote.author;
509509
}
510510

511-
function appendQuote() {
511+
function replaceQuote() {
512512
const quoteElem = document.getElementById("quote");
513513
const authorElem = document.getElementById("author");
514-
quoteElem.textContent = "";
515-
authorElem.textContent = "";
516-
quoteElem.append(state.quote);
517-
authorElem.append(state.author);
514+
quoteElem.textContent = state.quote;
515+
authorElem.textContent = state.author;
518516
}
519517

520518
document.getElementById("new-quote").addEventListener("click", function () {
521-
setup();
519+
showNewQuote();
522520
});
523521

524-
window.onload = setup;
522+
window.onload = showNewQuote;

0 commit comments

Comments
 (0)