File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
500500const 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
520518document . getElementById ( "new-quote" ) . addEventListener ( "click" , function ( ) {
521- setup ( ) ;
519+ showNewQuote ( ) ;
522520} ) ;
523521
524- window . onload = setup ;
522+ window . onload = showNewQuote ;
You can’t perform that action at this time.
0 commit comments