Skip to content

Commit 16e8e89

Browse files
committed
Quote-generator is done
1 parent 4222cda commit 16e8e89

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎Sprint-3/quote-generator/index.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
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 app</title>
77
<script defer src="quotes.js"></script>
88
</head>
99
<body>

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,18 @@ const quotes = [
491491
];
492492

493493
// call pickFromArray with the quotes array to check you get a random quote
494+
495+
const quoteElement = document.getElementById("quote");
496+
const authorElement = document.getElementById("author");
497+
const button = document.getElementById("new-quote");
498+
499+
function showRandomQuote() {
500+
const randomQuote = pickFromArray(quotes);
501+
502+
quoteElement.textContent = randomQuote.quote;
503+
authorElement.textContent = randomQuote.author;
504+
}
505+
506+
showRandomQuote();
507+
508+
button.addEventListener("click", showRandomQuote);

0 commit comments

Comments
 (0)