File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 1- <!DOCTYPE html>
1+ <!doctype html>
22< html lang ="en ">
33 < head >
44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6- < title > Title here </ title >
6+ < title > Quote Generator </ title >
77 < script defer src ="quotes.js "> </ script >
88 </ head >
99 < body >
10- < h1 > hello there </ h1 >
10+ < h1 > Quote Generator </ h1 >
1111 < p id ="quote "> </ p >
1212 < p id ="author "> </ p >
1313 < button type ="button " id ="new-quote "> New quote</ button >
Original file line number Diff line number Diff line change 1+ const quoteP = document . querySelector ( "#quote" ) ;
2+ const authorP = document . querySelector ( "#author" ) ;
3+ const button = document . querySelector ( "#new-quote" ) ;
4+
5+ function displayQuote ( ) {
6+ const randomQuote = pickFromArray ( quotes ) ;
7+ quoteP . innerText = randomQuote . quote ;
8+ authorP . innerText = randomQuote . author ;
9+ }
10+
11+ button . addEventListener ( "click" , displayQuote ) ;
12+
113// DO NOT EDIT BELOW HERE
214
315// pickFromArray is a function which will return one item, at
@@ -491,3 +503,4 @@ const quotes = [
491503] ;
492504
493505// call pickFromArray with the quotes array to check you get a random quote
506+ displayQuote ( ) ;
You can’t perform that action at this time.
0 commit comments