We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e2b55a commit 43be954Copy full SHA for 43be954
1 file changed
Sprint-1/destructuring/exercise-3/exercise.js
@@ -9,13 +9,16 @@ let order = [
9
10
let total = 0;
11
12
+console.log("QTY ITEM TOTAL");
13
+
14
order.forEach(({ itemName, quantity, unitPricePence }) => {
15
const itemTotal = quantity * unitPricePence;
16
total += itemTotal;
17
18
console.log(
- `${itemName} x${quantity} = £${(itemTotal / 100).toFixed(2)}`
19
+ `${String(quantity).padEnd(6)}${itemName.padEnd(17)}${(itemTotal / 100).toFixed(2)}`
20
);
21
});
22
-console.log(`Total: £${(total / 100).toFixed(2)}`);
23
+console.log("");
24
+console.log(`Total: ${(total / 100).toFixed(2)}`);
0 commit comments