Skip to content

Commit d0918b1

Browse files
committed
GLASGOW | 26-ITP-Jan | Prakash Dcosta | Sprint 2 | Book Library
1 parent b926738 commit d0918b1

3 files changed

Lines changed: 1 addition & 37 deletions

File tree

‎Sprint-1/destructuring/exercise-1/exercise.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const personOne = {
66

77
// Update the parameter to this function to make it work.
88
// Don't change anything else.
9-
function introduceYourself({ name, age, favouriteFood }) {
9+
function introduceYourself(___________________________) {
1010
console.log(
1111
`Hello, my name is ${name}. I am ${age} years old and my favourite food is ${favouriteFood}.`
1212
);

‎Sprint-1/destructuring/exercise-2/exercise.js‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,3 @@ let hogwarts = [
7070
occupation: "Teacher",
7171
},
7272
];
73-
/* Task 1 */
74-
function houseGryffindorNames(array) {
75-
array.forEach(({ firstName, lastName, house }) => {
76-
if (house === "Gryffindor") {
77-
console.log(firstName, lastName);
78-
}
79-
});
80-
}
81-
houseGryffindorNames(hogwarts);
82-
83-
/* Task 2 */
84-
function teachersPetNames(array) {
85-
array.forEach(({ firstName, lastName, occupation, pet }) => {
86-
if (occupation === "Teacher" && pet !== null) {
87-
console.log(firstName, lastName);
88-
}
89-
});
90-
}
91-
teachersPetNames(hogwarts);

‎Sprint-1/destructuring/exercise-3/exercise.js‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,3 @@ let order = [
66
{ itemName: "Hot Coffee", quantity: 2, unitPricePence: 100 },
77
{ itemName: "Hash Brown", quantity: 4, unitPricePence: 40 },
88
];
9-
10-
function takeOutOrder(order) {
11-
let totalSum = 0;
12-
13-
console.log("OTY ITEM TOTAL");
14-
order.forEach(({ quantity, itemName, unitPricePence }) => {
15-
const itemTotal = (quantity * unitPricePence) / 100;
16-
totalSum += itemTotal;
17-
18-
console.log(
19-
`${quantity} ${itemName.padEnd(18)} ${itemTotal.toFixed(2)}`
20-
);
21-
});
22-
23-
console.log(`\nTotal: ${totalSum.toFixed(2)}`);
24-
}
25-
takeOutOrder(order);

0 commit comments

Comments
 (0)