The challenge asks “Return the sum of those two numbers plus the sum of all the numbers between them”
So the last console.log should return me a 8 and not 4
I misread the else condition - I don’t see why this would be a bug. That code meets the requirements. The wording of the requirements is slightly awkward but the last console log most certainly should not give you 8 - the sum of all numbers between 4 and 4 is definitely 4.
You have a good point here. Sounds like we should update the instructions because the original intent here was not to sum the 4 and 4 in a case like this.
Maybe the instructions could read as follows:
We’ll pass you an array of two different integers. Return the sum of those two integers plus the sum of all the integers between them. The lowest number will not always come first.
This way we never have to worry about adding the test case of [4, 4] because the requirements are the two integers will always be different.