Skip to content
Open
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why rename index.html?

You missed updating this HTML file according to an instruction in readme.md.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. noted i will not make such mistake again to ignor instructions.
  2. i have corrected the file name and renamed the title in the file.

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
21 changes: 19 additions & 2 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
// call pickFromArray with the quotes array to check you get a random quote
function displayRandomQuote() {
const quoteP = document.getElementById("quote");
const authorP = document.getElementById("author");

const selectedQuote = pickFromArray(quotes);

quoteP.textContent = selectedQuote.quote;
authorP.textContent = selectedQuote.author;
}

// Setup event listener and display initial quote on load
window.addEventListener("DOMContentLoaded", () => {
displayRandomQuote();

const newQuoteBtn = document.getElementById("new-quote");
newQuoteBtn.addEventListener("click", displayRandomQuote);
});

// DO NOT EDIT BELOW HERE

// pickFromArray is a function which will return one item, at
Expand Down Expand Up @@ -489,5 +508,3 @@ const quotes = [
author: "Zig Ziglar",
},
];

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