Untitled

 avatar
unknown
javascript
10 months ago
385 B
6
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