(sum, percentage, locale, currency)
| 17 | }; |
| 18 | |
| 19 | const tipCalculator = (sum, percentage, locale, currency) => { |
| 20 | let tip = sum * (percentage / 100); |
| 21 | let total = sum + tip; |
| 22 | |
| 23 | console.log(` |
| 24 | Sum before tip: ${formatter(locale, currency, sum)} |
| 25 | Tip percentage: ${percentage}% |
| 26 | Tip: ${formatter(locale, currency, tip)} |
| 27 | Total: ${formatter(locale, currency, total)} |
| 28 | `); |
| 29 | }; |
| 30 | |
| 31 | tipCalculator(29.95, 18, "de-DE", "EUR"); |