-
-
Notifications
You must be signed in to change notification settings - Fork 234
Manchester | 26-ITP-Jan | Ofonime Edak | Sprint 1 | Feature/Destructuring #407
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
fd42ed0
269406b
3e0c968
7d1585a
be17291
c27521a
d7d6d4a
0e7a1ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any console output here
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It logs this message to the console: Hello, my name is Popeye. I am 34 years old and my favourite food is Spinach. When I run this on my terminal: Module-Data-Flows\sprint-1\destructuring\exercise-1> node exercise.js There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My comment refers to exercise 2 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,23 @@ let order = [ | |
| { itemName: "Hot Coffee", quantity: 2, unitPricePence: 100 }, | ||
| { itemName: "Hash Brown", quantity: 4, unitPricePence: 40 }, | ||
| ]; | ||
|
|
||
| function orderReceipt(orderItems) { | ||
| const totalList = []; | ||
| for (const item of orderItems) { | ||
| const { itemName, quantity, unitPricePence } = item; | ||
|
|
||
| const total = ((quantity * unitPricePence) / 100).toFixed(2); | ||
| totalList.push(total); | ||
| const itemInfo = console.log(` ${quantity} ${itemName} ${total} `); | ||
| } | ||
|
|
||
| const grandTotal = totalList.reduce((accumulator, current) => { | ||
| const totalCost = Number(accumulator) + Number(current); | ||
| return totalCost; | ||
| }, 0); | ||
| const finalBill = grandTotal.toFixed(2); | ||
| console.log(`Total:${finalBill}`); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The formatting of the console output does not match the requirements |
||
| } | ||
|
|
||
| orderReceipt(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.
What does this log?