Design a Sum All Numbers Algorithm - Design a Sum All Numbers Algorithm

Tell us what’s happening:

A little confused here, I am running the function and it appears I am getting the correct results, however I am not passing.

Console:

// running tests
3. sumAll([1, 4]) should return 10.
4. sumAll([4, 1]) should return 10.
5. sumAll([5, 10]) should return 45.
6. sumAll([10, 5]) should return 45.
// tests completed
// console output
10
10
45
45

Your code so far

function sumAll(...arrOf2) {
    let minNum = Math.min(...arrOf2);
    let maxNum = Math.max(...arrOf2);
    let sum = 0;
    for (let i = minNum; i <= maxNum; i++) {
        sum += i;
    };
    return sum;
}

console.log(sumAll(1, 4)); // 10
console.log(sumAll(4, 1)); // 10
console.log(sumAll(5, 10)); // 45
console.log(sumAll(10, 5)); //45

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36

Challenge Information:

Design a Sum All Numbers Algorithm - Design a Sum All Numbers Algorithm

try calling this function, with an array as parameter. The code in your editor does not use an array as parameter

Thank you, I was able to figure it out from there