<!--
title: Extract for better readability
domain: app-frameworks
topic: Code Style
language: JavaScript
source: axios/axios
updated: 
url: https://awesomereviewers.com/reviewers/axios-extract-for-better-readability/
-->

Complex expressions and repeated code should be extracted into well-named variables to improve readability and maintainability. This applies to:
- Repeated string/value combinations
- Complex conditional logic
- Array transformations
- URL or path constructions

Example - Instead of:
```javascript
if ([options.path, responseDetails.headers.location].every(item => item === '/foo')) {
  // ...
}
```

Better approach:
```javascript
const isPathMatching = options.path === '/foo';
const isLocationMatching = responseDetails.headers.location === '/foo';
if (isPathMatching && isLocationMatching) {
  // ...
}
```

This practice:
- Makes code self-documenting through meaningful variable names
- Reduces cognitive load when reading complex logic
- Makes debugging easier by providing clear intermediate values
- Prevents duplicate calculations
