-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
base: main
Are you sure you want to change the base?
West Midlands | Samira Hekmati | Module-Data-Flows | Sprint-1 | Destructuring #130
Conversation
@@ -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) { |
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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" ){ |
There was a problem hiding this comment.
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") { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.