Problem with "Sum All Numbers in a Range"

Tell us what’s happening:


My code is exactly the same as the official answer from FCC but with a different syntax and yet FCC keeps telling me my code is wrong…WHy do I get an output of 6 and not 10 as intended? Whats wrond please?

Your code so far

function sumAll(arr) {
  var MaxNumber= Math.max(arr[0],arr[1]);
  var MinNumber = Math.min(arr[0],arr[1]);
  var temp=0;
 for(var i=MinNumber; i<MaxNumber;i++)
  return (temp);

sumAll([1, 4]);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0.

Link to the challenge:

I think you want your loop to continue until i <= MaxNumber to be sure it reaches the max value

You are not adding MaxNumber to your sum.