(sum, percentage)
| 9 | */ |
| 10 | |
| 11 | const tipCalculator = (sum, percentage) => { |
| 12 | let tip = sum * (percentage / 100); |
| 13 | let total = sum + tip; |
| 14 | console.log(` |
| 15 | Sum before tip: ${sum} |
| 16 | Tip percentage: ${percentage}% |
| 17 | Tip: ${tip.toFixed(2)} |
| 18 | Total: ${total.toFixed(2)} |
| 19 | `); |
| 20 | }; |
| 21 | |
| 22 | tipCalculator(29.95, 18); |