The Issue with step 101 in javascript spreadsheet


I think it would have been much better if the requirement text were a bit more clear. I had to spend quite a lot of time to finally understand what it actually wanted…

1 Like

I agree. The directions here aren’t clear at all. I managed to “solve” this one by guessing at what was being asked of us. I had the “range” property as

nums => range(nums[0],nums[1])

and this was accepted. The directions should really specify that we’re expected to produce a range between the first two elements of the array.

Furthermore, the accepted solution is buggy. When we defined the range() function earlier, we had it use the Array() constructor:

Array(end - start + 1)

If start is greater than end, this would call the constructor with a non-positive argument and throw a RangeError (or create an empty array if start === end + 1). Since we don’t know what’s in the nums array, this could certainly happen. Also, there’s no guarantee that the values in the nums array are integers. Passing a float to the Array() constructor would also throw an error.

Since this course is still in the beta stage, I think that this should be fixed before the course is finalized.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.