File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ <h1>Tip Calculator</h1>
14
14
< table >
15
15
< thead >
16
16
< tr >
17
- < th > Product </ th >
17
+ < th > Name </ th >
18
18
< th > Price</ th >
19
19
< th > Unit</ th >
20
20
< th > Money</ th >
Original file line number Diff line number Diff line change @@ -79,6 +79,17 @@ function calculateTotal() {
79
79
finalTipSpan . classList . add ( "error-highlight" ) ;
80
80
totalSpan . classList . add ( "error-highlight" ) ;
81
81
}
82
+
83
+ const report = { products : [ ] , tip : tipValue } ;
84
+
85
+ for ( let row = 0 ; row < productRows . length ; row ++ ) {
86
+ const nameValue = productRows [ row ] . children [ 0 ] . firstElementChild . value ;
87
+ const priceValue = productRows [ row ] . children [ 1 ] . firstElementChild . value ;
88
+ const unitValue = productRows [ row ] . children [ 2 ] . firstElementChild . value ;
89
+ const product = { name : nameValue , price : priceValue , unit : unitValue } ;
90
+ report . products . push ( product ) ;
91
+ }
92
+ console . log ( report ) ;
82
93
}
83
94
84
95
function cleanTotal ( ) {
You can’t perform that action at this time.
0 commit comments