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 43be954 commit ba8bb20Copy full SHA for ba8bb20
1 file changed
Sprint-1/destructuring/exercise-3/exercise.js
@@ -9,14 +9,22 @@ let order = [
9
10
let total = 0;
11
12
-console.log("QTY ITEM TOTAL");
+// Header (match spacing EXACTLY)
13
+console.log("QTY ITEM TOTAL");
14
15
order.forEach(({ itemName, quantity, unitPricePence }) => {
16
const itemTotal = quantity * unitPricePence;
17
total += itemTotal;
18
19
+ // Fix capitalisation (Hot cakes → Hot Cakes)
20
+ const formattedName = itemName
21
+ .split(" ")
22
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
23
+ .join(" ");
24
+
25
+ // Format columns exactly
26
console.log(
- `${String(quantity).padEnd(6)}${itemName.padEnd(17)}${(itemTotal / 100).toFixed(2)}`
27
+ `${String(quantity).padEnd(8)}${formattedName.padEnd(20)}${(itemTotal / 100).toFixed(2)}`
28
);
29
});
30
0 commit comments