()
| 82 | |
| 83 | //Update the balance income and expence |
| 84 | function updateValues() { |
| 85 | const amounts = transactions.map( |
| 86 | (transaction) => transaction.amount |
| 87 | ); |
| 88 | const total = amounts |
| 89 | .reduce((acc, item) => (acc += item), 0) |
| 90 | .toFixed(2); |
| 91 | const income = amounts |
| 92 | .filter((item) => item > 0) |
| 93 | .reduce((acc, item) => (acc += item), 0) |
| 94 | .toFixed(2); |
| 95 | const expense = |
| 96 | (amounts |
| 97 | .filter((item) => item < 0) |
| 98 | .reduce((acc, item) => (acc += item), 0) * |
| 99 | -1).toFixed(2); |
| 100 | |
| 101 | balance.innerText=`$${total}`; |
| 102 | money_plus.innerText = `$${income}`; |
| 103 | money_minus.innerText = `$${expense}`; |
| 104 | } |
| 105 | |
| 106 | |
| 107 | //6 |
no outgoing calls
no test coverage detected