passed all tests

This commit is contained in:
Fredrik Uddenfeldt 2023-05-21 21:29:53 +02:00
parent a15eafb564
commit 8f82e0a685
1 changed files with 9 additions and 0 deletions

View File

@ -7,6 +7,15 @@ const sumAll = function(x, y) {
if (x < 0 || y < 0) {return('ERROR')}
else if (Number.isInteger(x) == false || Number.isInteger(y) == false) {return('ERROR')}
else if (x > y) {
let X = y;
let Y = x;
for (let i = X+1; i <=Y; i++) {
theSum = X += i
}
return theSum
}
else