(locale = "en-US", currency = "USD", value)
| 8 | */ |
| 9 | |
| 10 | const formatter = (locale = "en-US", currency = "USD", value) => { |
| 11 | let formattedValue = new Intl.NumberFormat(locale, { |
| 12 | style: "currency", |
| 13 | currency: currency, |
| 14 | }).format(value); |
| 15 | |
| 16 | return formattedValue; |
| 17 | }; |
| 18 | |
| 19 | const tipCalculator = (sum, percentage, locale, currency) => { |
| 20 | let tip = sum * (percentage / 100); |