✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
You have the following code:
return order.quantity * order.itemPrice - Math.max(0, order.quantity - 500) * order.itemPrice * 0.05 + Math.min(order.quantity * order.itemPrice * 0.1, 100);
You
refactor it so that it becomes:
const basePrice = order.quantity * order.itemPrice;const quantityDiscount = Math.max(0, order.quantity - 500) * order.itemPrice * 0.05;const shipping = Math.min(basePrice * 0.1, 100);return basePrice - quantityDiscount + shipping;
What type of refactoring is this?
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!