Untitled
Anonymous
javascript
09/02/2024 9:30 PM
516 B
18
Indexable
//Max discount needs to be 0.5
function calculateDiscount(price, discount) {
if (discount > 0.5 && discount == 0.5) {
discount = 0.5;
}
return price - (price * discount);
}
console.log(calculateDiscount(100, 0.6));
function getInstallmentAmount(totalAmount, qtyInstallments) {
return totalAmount / qtyInstallments
}
console.log(getInstallmentAmount(100, 2));Editor is loading...
Leave a Comment