Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

West Midlands | Samira Hekmati | Module-Data-Flows | Sprint-1 | Destructuring #130

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

samirahekmati
Copy link

@samirahekmati samirahekmati commented Jan 9, 2025

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@samirahekmati samirahekmati added the Needs Review Participant to add when requesting review label Jan 9, 2025
@@ -6,7 +6,7 @@ const personOne = {

// Update the parameter to this function to make it work.
// Don't change anything else.
function introduceYourself(___________________________) {
function introduceYourself(name,age,favouriteFood) {

Choose a reason for hiding this comment

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

This is almost there, but if you run the code you'll see it gives a weird answer when you print out the line!

Can you see what is going wrong?


//Task 1
function GryffindorHouse(arr){
for(const {firstName, lastName, house} of arr){

Choose a reason for hiding this comment

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

I like the destructing in the for loop 🙂

//Task 1
function GryffindorHouse(arr){
for(const {firstName, lastName, house} of arr){
if(house == "Gryffindor" ){

Choose a reason for hiding this comment

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

The formatting here is a bit inconsistent. Can you think of reasons why you'd want to ensure the formatting is consistent across the code?

//Task 2
function teachersWithPet(arr) {
for (const { firstName, lastName, pet, occupation } of arr) {
if (pet != null && occupation === "Teacher") {

Choose a reason for hiding this comment

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

In one check you've used == and in another you've used ===. Are you happy with the differences between the two, and when to use them?

let total = (quantity * unitPricePence) / 100;
grandTotal += total;
// Format the output to align columns
let qtystr = quantity.toString().padEnd(8);

Choose a reason for hiding this comment

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

Nice use of padEnd here

console.log("Total:",grandTotal.toFixed(2));
}

receipt(order);

Choose a reason for hiding this comment

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

This is very close to the format requested. At first I thought it was perfectly identical. But I've since spotted a couple of minor differences. Can you see what they are and fix them?

@ChrisCookOC ChrisCookOC added Reviewed Volunteer to add when completing a review Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Participant to add when requesting review Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jan 16, 2025
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants