Sum All Numbers in a Range0

Tell us what’s happening:
I will code myself, tell me where i’m wrong or any explanation to solve it. Thanks in advance

Your code so far

function sumAll(arr) {
  var sum = 0;
  var min = Math.min(arr);
  var max = Math.max(arr);
  for (let i = min; i <= max; i++) {
     sum = sum + i;
  return sum;

sumAll([1, 4]);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0.

Link to the challenge:

1 Like