Skip to content
Closed
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
2 changes: 1 addition & 1 deletion Sprint-3/quote-generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title here</title>
<title>Quote generator app</title>
<script defer src="quotes.js"></script>
</head>
<body>
Expand Down
16 changes: 16 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,19 @@ const quotes = [
];

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

const newQuoteButton = document.querySelector("#new-quote");
const quoteDisplay = document.querySelector("#quote");

function displayQuote() {
const randomQuote = pickFromArray(quotes);

const quote = randomQuote.quote;
const author = randomQuote.author;

quoteDisplay.innerText = `${quote}\n${author}`;
}

displayQuote();

newQuoteButton.addEventListener("click", displayQuote);