**Tell us what’s happening:**

Describe your issue in detail here.

So I’m starting to get worried that I’m not learning things as I should because a lot of the time, the solutions that I come up with (though they work) look very different from the solutions that are provided. They’re a lot longer and messier. This problem in particular is a prime example. If I try to think of solutions on my own without cheating, I end up writing janky code so I just want to ask if it’s alright to keep going this way or if it’s better to just look at the proper solution and study that instead?

```
**Your code so far**
```

```
function sumAll(arr) {
let emptyArr = []
if (arr[0] < arr[1]) {
for (let i = arr[0]; i <= arr[1]; i++) {
emptyArr.push(i);
}
} else if (arr[0] > arr[1]) {
for (let i = arr[0]; i >= arr[1]; i--) {
emptyArr.push(i);
}
}
let newArr = emptyArr.reduce((a, b) => a + b, 0)
return newArr;
}
sumAll([1, 4]);
```

```
**Your browser information:**
```

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44`

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

**Link to the challenge:**