> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Max-Min-Identity

#### Sourcery rule id: `max-min-identity`

#### Description

Use max/min instead of if statement


#### Before

```javascript
if (a < b) {
  c = a
} else {
  c = b
}
```

#### After

```javascript
c = Math.min(a, b)
```



#### Explanation

We often need to work out the smallest or largest of two values, and the
most readable way to do this is to use the built-in `min` and `max`
functions. This results in a shorter and clearer way to achieve the same result.
