(providedData = data)
| 70 | |
| 71 | // Update DOM |
| 72 | function updateDOM(providedData = data) { |
| 73 | // Clear main div |
| 74 | main.innerHTML = '<h2><strong>Person</strong> Wealth</h2>'; |
| 75 | |
| 76 | providedData.forEach(item => { |
| 77 | const element = document.createElement('div'); |
| 78 | element.classList.add('person'); |
| 79 | element.innerHTML = `<strong>${item.name}</strong> ${formatMoney( |
| 80 | item.money |
| 81 | )}`; |
| 82 | main.appendChild(element); |
| 83 | }); |
| 84 | } |
| 85 | |
| 86 | // Format number as money - https://stackoverflow.com/questions/149055/how-to-format-numbers-as-currency-string |
| 87 | function formatMoney(number) { |
no test coverage detected