MCPcopy Create free account
hub / github.com/LinkedInLearning/javascript-essential-training-2832077 / printHTML

Function printHTML

08_10/script.js:17–38  ·  view source on GitHub ↗
(finalTip)

Source from the content-addressed store, hash-verified

15
16// Callback receives finalTip object, creates and outputs table on the DOM.
17const 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.
41const tipCalculator = (sum, percentage, locale, currency) => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected