04
Inline Variable
Goal
Single-use variables that just rename their right-hand side disappear; the expression speaks for itself.
Before the refactoring
const basePrice = order.basePrice;
return basePrice > 1000;After the refactoringreturn order.basePrice > 1000;Savings
Less local clutter, fewer redundant names, smaller scopes to track.
Note
Inlining a name that did carry domain meaning costs readability — only inline when the expression is already self-explanatory.