(finalTip)
| 15 | |
| 16 | // Callback receives finalTip object, creates and outputs table on the DOM. |
| 17 | const printHTML = (finalTip) => { |
| 18 | const tipTable = document.createElement("table"); |
| 19 | tipTable.innerHTML = ` |
| 20 | <tr> |
| 21 | <td>Sum before tip:</td> |
| 22 | <td>${finalTip.sum}</td> |
| 23 | </tr> |
| 24 | <tr> |
| 25 | <td>Tip percentage:</td> |
| 26 | <td>${finalTip.percentage}</td> |
| 27 | </tr> |
| 28 | <tr> |
| 29 | <td>Tip:</td> |
| 30 | <td>${finalTip.tip}</td> |
| 31 | </tr> |
| 32 | <tr> |
| 33 | <td>Total:</td> |
| 34 | <td>${finalTip.total}</td> |
| 35 | </tr> |
| 36 | `; |
| 37 | document.querySelector("main").append(tipTable); |
| 38 | }; |
| 39 | |
| 40 | // Create a finalTip object with all the data. Send it to the printHTML callback. |
| 41 | const tipCalculator = (sum, percentage, locale, currency) => { |
nothing calls this directly
no outgoing calls
no test coverage detected