Developer · Comparison

See exactly what changed.

Paste two versions of any text or code. Get a clean line-by-line diff with added, removed, and unchanged lines highlighted — inline or split view.

+774 unchanged
Original
Modified
Diff Output
1+function calculateTotal(items, applyTax = false) {
2+ const subtotal = items.reduce((sum, item) => sum + item.price, 0);
3+ if (applyTax) {
4+ return subtotal * (1 + TAX_RATE);
1function calculateTotal(items) {
2 let total = 0;
3 for (let i = 0; i < items.length; i++) {
4 total += items[i].price;
5 }
6+ return subtotal;
6 return total;
7 }
8
9+const TAX_RATE = 0.1;
9const TAX_RATE = 0.08;
10
11+export { calculateTotal };
11module.exports = { calculateTotal };
← Back to all toolslocal-first, always