Skip to content

Commit 3ceb38c

Browse files
committed
Refactor printReceipt function for improved readability
1 parent d831ae8 commit 3ceb38c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ let order = [
88
];
99

1010
function printReceipt(order){
11-
let total = 0 , qtyWidthMax = 3, itemWidthMax = 4
11+
let total = 0
12+
let qtyWidthMax = 3
13+
let itemWidthMax = 4
1214
const receiptLines = order.map(({itemName, quantity, unitPricePence}) => {
13-
const itemTotalPounds = (quantity*unitPricePence/100);
15+
const itemTotalPounds = (quantity * (unitPricePence / 100));
1416
qtyWidthMax = Math.max(qtyWidthMax, String(quantity).length);
1517
itemWidthMax = Math.max(itemWidthMax, itemName.length);
1618
return { itemName, quantity, itemTotalPounds };

0 commit comments

Comments
 (0)