2024-01-05 20:37:06 +00:00
|
|
|
const sumAll = function(a, b) {
|
2024-01-05 20:46:07 +00:00
|
|
|
if (a < 0 || b < 0) {
|
|
|
|
return "ERROR";
|
|
|
|
}
|
2024-01-05 20:43:56 +00:00
|
|
|
let c, sum = 0;
|
|
|
|
for ((a > b) ? (i = b, c = a)
|
|
|
|
: (i = a, c = b); i <= c; i++) {
|
2024-01-05 20:37:06 +00:00
|
|
|
sum += i;
|
|
|
|
}
|
|
|
|
return sum;
|
2024-01-05 19:11:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Do not edit below this line
|
|
|
|
module.exports = sumAll;
|