**Tell us what’s happening:**

Does the built-in .sort() method decrease performance? I understand it’s negligible in this case. I read that different browsers handle .sort() in their own way but they all tend to be logarithmic. Is it more efficient to get the minimum and maximum values from the array? Why?

```
function sumAll(arr) {
let sum = 0
arr.sort((a,b) => a-b)
for(let i = arr[0]; i <= arr[1]; i++) sum += i
return sum
}
console.log(sumAll([4, 1]))
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36`

**Challenge:** Sum All Numbers in a Range

**Link to the challenge:**