EasyJavaScriptPractice mode: untimed, 3 hints
Free shipping threshold
shippingFee(cartTotal, isMember) returns the shipping charge in rupees. Orders of ₹499 or more ship free; below that shipping costs ₹49. Members always ship free.
The code has exactly one planted bug. Reproduce it with the tests, fix it with the smallest change, then submit.
Visible tests
exactly the threshold
- shippingFee(499, false) → 0
small order
- shippingFee(200, false) → 49
member
- shippingFee(100, true) → 0
Hints 0/3
const FREE_SHIPPING_FROM = 499;
const SHIPPING_FEE = 49;
// Orders of ₹499 or more ship free; below that, shipping is ₹49. Members always ship free.
function shippingFee(cartTotal, isMember) {
if (isMember) return 0;
if (cartTotal > FREE_SHIPPING_FROM) return 0;
return SHIPPING_FEE;
}
Ctrl/⌘+Enter runs, Ctrl/⌘+Shift+Enter submits. In the editor, Ctrl+M switches Tab to moving focus.
Run works without an account. Log in to submit against the hidden tests and track your accuracy per bug type.
Ready for pressure? Try a timed set: six snippets, 20 minutes, no hints.