Skip to content

Sheffield | 26-ITP-Jan | Mahammad Osman | Sprint 3| Quote generator#1165

Open
Darkidd77 wants to merge 4 commits intoCodeYourFuture:mainfrom
Darkidd77:quote-generator
Open

Sheffield | 26-ITP-Jan | Mahammad Osman | Sprint 3| Quote generator#1165
Darkidd77 wants to merge 4 commits intoCodeYourFuture:mainfrom
Darkidd77:quote-generator

Conversation

@Darkidd77
Copy link
Copy Markdown

@Darkidd77 Darkidd77 commented Apr 2, 2026

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

  • Followed the concept of Input/Process/Output to structure the code.
  • Used the provided helper function to choose a random quote from the array, and created a core function to update the quote and author on the screen.
  • Added an event listener to the button to trigger the function when clicked.

@Darkidd77 Darkidd77 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Apr 2, 2026
@jayshreehajgude2012 jayshreehajgude2012 added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Apr 4, 2026
Copy link
Copy Markdown

@jayshreehajgude2012 jayshreehajgude2012 left a comment

Choose a reason for hiding this comment

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

Good use of inbuild functions.
Work on cleanliness of the code.
Explore more DOM methos to access elemnts.

<title>Title here</title>
<link rel="stylesheet" href="style.css" />
<title>Quote generator app</title>
<script defer src="quotes.js"></script>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

JavaScript File linked correctly to html.


// You don't need to change this function
function pickFromArray(choices) {
return choices[Math.floor(Math.random() * choices.length)];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

inbuilt functions correctly used.

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

// getting the input and button elements from the page
const quoteElement = document.getElementById("quote");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

document.getElementById() is one of the way of accessing DOM elements. You can explore more DOM methods.


function displayRandomQuote() {
// get a random quote from the quotes array
const randomQuote = pickFromArray(quotes);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pickFromArray(quotes) used correctly.

displayRandomQuote(); // display a random quote when the page loads

// display a new random quote when button is clicked
buttonElement.addEventListener("click", () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Event handler used correctly.

Comment on lines 438 to 447
quote:
"It's your place in the world; it's your life. Go on and do all you can with it, and make it the life you want to live.",
author: "Mae Jemison",
},
{
quote:
"You may be disappointed if you fail, but you are doomed if you don't try.",
author: "Beverly Sills",
},
{
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You can work on cleanliness of code.

@jayshreehajgude2012 jayshreehajgude2012 added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants