Repository navigation
Manchester | 26-ITP-Sep | Mathew Shaibu | Sprint 1 | Feature/destructuring - #598
MattCarolus10 wants to merge 5 commits into
Conversation
| }, | ||
| ]; | ||
|
|
||
| hogwarts.forEach(({ firstName, lastName, house }) => { |
There was a problem hiding this comment.
Just a tip: We could add something similar to the example below. It would make the output easier to understand and help readers follow the code, especially when reviewing the results of each task.
// Task 1
console.log('===========Task 1===========')
hogwarts.forEach(({ firstName, lastName, house }) => {
if (house === "Gryffindor") console.log(${firstName} ${lastName});
});
// Task 2
console.log('===========Task 2===========')
hogwarts.forEach(({ firstName, lastName, pet, occupation }) => {
if (occupation === "Teacher" && pet) console.log(${firstName} ${lastName});
});
| ); | ||
| totalPence += lineTotalPence; | ||
| }); | ||
| console.log("\nTotal:" + (totalPence / 100).toFixed(2)); |
There was a problem hiding this comment.
You've demonstrated a good understanding of JavaScript object destructuring, array iteration, calculations, and string formatting.
I particularly like your approach of working with integer pence to avoid floating-point precision issues.
The solution is clear, readable, and meets all the exercise requirements.
Keep up the great work, and keep practising!
ravinder25886
left a comment
There was a problem hiding this comment.
You've demonstrated a good understanding of JavaScript object destructuring, array iteration, calculations, and string formatting.
I particularly like your approach of working with integer pence to avoid floating-point precision issues.
The solution is clear, readable, and meets all the exercise requirements.
Keep up the great work, and keep practising!
Self checklist
Task code
CYF-1112
Changelist
I de-structured the code in the exercises