Skip to content
Closed
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
10 changes: 10 additions & 0 deletions Sprint-3/quote-generator/quotes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
const showNewQuote = () => {
const {quote, author} = pickFromArray(quotes);
document.getElementById("quote").innerText = quote;
document.getElementById("author").innerText = author;
};

document.addEventListener("DOMContentLoaded", showNewQuote);

document.querySelector("button").addEventListener("click", showNewQuote);

Comment on lines +1 to +10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don’t see any trainee-written comments in this change set, only code. Since the functions and event listeners here are already quite clear (showNewQuote and the click handler are self-explanatory), this is a nice example of code that doesn’t need extra comments at all. As you keep working, you might ask yourself: whenever you feel the urge to add a comment, is there a way to make the code or naming so clear that the comment becomes unnecessary? That habit will keep your codebase easier to read and maintain.

To "like" or "dislike" this comment, please follow this link

// DO NOT EDIT BELOW HERE

// pickFromArray is a function which will return one item, at
Expand Down
Loading