Skip to content

Commit 302e2c0

Browse files
committed
quote generator app
1 parent 4222cda commit 302e2c0

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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/package.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
"bugs": {
1414
"url": "https://github.com/CodeYourFuture/CYF-Coursework-Template/issues"
1515
},
16-
"homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme"
16+
"homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme",
17+
"devDependencies": {
18+
"jsdom": "^20.0.3"
19+
}
1720
}

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

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

493493
// call pickFromArray with the quotes array to check you get a random quote
494+
495+
function displayQuote() {
496+
const selectedQuote = pickFromArray(quotes);
497+
498+
document.getElementById("quote").innerText = selectedQuote.quote;
499+
document.getElementById("author").innerText = selectedQuote.author;
500+
}
501+
502+
displayQuote();
503+
504+
document.getElementById("new-quote").addEventListener("click", displayQuote);

0 commit comments

Comments
 (0)