Free shipping
shippingFee(total) charges 10 below 100, gives free shipping from 100 and rejects a negative total. Your tests must pass on the correct code and catch the 4 bugs.
Exercise
/**
* Shipping fee for an order.
* - Orders of 100 or more ship free (fee 0).
* - Orders below 100 pay a fee of 10.
* - An empty order (total 0) also pays 10.
* - A negative total is a mistake: throws Error("Invalid total").
* @param {number} total
* @returns {number}
*/
function shippingFee(total)Your tests
0 of 4 bugs caught
- Bug 1: hidden
- Bug 2: hidden
- Bug 3: hidden
- Bug 4: hidden