Code Diff
Compare two code snippets side-by-side. AI explains what changed and why.
examples:
11 lines
3 lines
+1-92 unchanged
| 1 | 1 | function getUserName(user) { | |
| 2 | - | if (user !== null) { | |
| 3 | - | if (user.name !== undefined) { | |
| 4 | - | return user.name; | |
| 5 | - | } else { | |
| 6 | - | return 'Anonymous'; | |
| 7 | - | } | |
| 8 | - | } else { | |
| 9 | - | return 'Anonymous'; | |
| 10 | - | } | |
| 2 | + | return user?.name ?? 'Anonymous'; | |
| 11 | 3 | } |
How to read diffs
+
Added line
New line that exists only in the modified version
-
Removed line
Line that was deleted from the original
Unchanged
Line that is the same in both versions (context)