Diff
Compare two texts or two JSON documents.
Compare two texts or two JSON documents.
// Runs in your browser. Nothing you type here is sent anywhere.
3 added, 3 removed.
| Line in the original | Line in the changed text | Change | Line |
|---|---|---|---|
| 1 | removed | function total(items) { | |
| 1 | added | function total(items, taxRate = 0.21) { | |
| 2 | 2 | let sum = 0; | |
| 3 | 3 | for (const item of items) { | |
| 4 | removed | sum += item.price; | |
| 4 | added | sum += item.price * item.quantity; | |
| 5 | 5 | } | |
| 6 | removed | return sum; | |
| 6 | added | return sum * (1 + taxRate); | |
| 7 | 7 | } | |
| 8 | 8 | ||
| 9 | 9 | export default total; |