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