passes 5/6 tests

This commit is contained in:
Fredrik Uddenfeldt 2023-05-21 21:23:37 +02:00
parent 026eb4cd91
commit a15eafb564
1 changed files with 9 additions and 6 deletions

View File

@ -1,18 +1,21 @@
// Need to figure out how to deal with opposite order (largest first)
// and non-integer error with Number.isInteger()
const sumAll = function(x, y) {
let theSum;
if (x < 0 || y < 0) {return('ERROR')}
else if (Number.isInteger(x) == false || Number.isInteger(y) == false) {return('ERROR')}
else
{
for (let i = x+1; i <=y; i++) {
theSum = x += i
}
return theSum
}