function priceDiscountSeries(originalPrice, discountSeries) {
let netPrice = originalPrice;
for (let i = 0; i < discountSeries.length; i++) {
netPrice = originalPrice * (1 - discountSeries[i]);
}
return netPrice;
}
console.log(priceDiscountSeries(94_500, [0.40, 0.10, 0.05]));
What I'm trying to do is to have the result saved on a variable, then use that variable to return another result, which is again saved on the variable itself.