● Original Text9 lines
● Modified Text11 lines
Comparison Result (Side-by-Side Split View)
+7 Added-5 Removed
Original (Left)Modified (Right)
1-function calculateDiscount(price, userRole) {
1+function calculateDiscount(price, userRole, couponCode) {
2- if (userRole === "admin") {
2+ // VIP discount applies first
3- return price * 0.20;
3+ if (userRole === "admin" || userRole === "vip") {
4+ return price * 0.25;
4 }
5 }
5 if (userRole === "member") {
6 if (userRole === "member") {
6- return price * 0.10;
7+ const bonus = couponCode ? 0.05 : 0;
8+ return price * (0.10 + bonus);
7 }
9 }
8- return 0;
10+ return price > 100 ? 5 : 0;
9}
11}