Diff Compare

Paste two text or code blocks to generate a unified diff. Export results for pull requests or documentation.

+4 / -3 · 2 unchanged

Tip: paste directly into either pane or use Swap/Clear to manage revisions quickly.

Unified diff
1- function greet(name) {
2- return `Hello, ${name}!`;
1+ function greet(name, punctuation = "!") {
2+ if (!name) return "Hello" + punctuation;
3+ return `Hello, ${name}${punctuation}`;
34 }
45
5- greet("World");
6+ greet("World", "!!");