| const calculateFinalPrice = function(basePrice, taxRate, discount) { | |
| const applyTax = function(price, rate) { | |
| return price + price * rate; | |
| } | |
| const applyDiscount = function(price, discount) { | |
| return price - discount; | |
| } | |
| let priceWithTax = applyTax(basePrice, taxRate); | |
| let finalPrice = applyDiscount(priceWithTax, discount); | |
| return finalPrice; | |
| } | |
| console.log(calculateFinalPrice(100, 0.2, 10)); // Output: 110 |