**Tell us what’s happening:**

Why this method isnt working? Is there any logic mistake i make?

**Your code so far**

```
function sumAll(arr) {
let sum = 0;
if(arr[0] < arr[1]){
for(let i = arr[0]; i<= arr[1];i++){
sum += i;
}
} else{
for(let i = arr[1]; i>= arr[0];i--){
sum += i;
}
}
return sum;
}
sumAll([1, 4])
function sumAll(arr) {
let sum = 0;
if(arr[0] < arr[1]){
for(let i = arr[0]; i<= arr[1];i++){
sum += i;
}
} else{
for(let i = arr[1]; i>= arr[0];i--){
sum += i;
}
}
return sum;
}
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/71.0.3578.98 Safari/537.36`

.

**Link to the challenge:**

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-numbers-in-a-range