odin-default-js-exercises/05_sumAll/sumAll.js

20 lines
277 B
JavaScript

const sumAll = function(x, y) {
let theSum;
for (let i = x+1; i <=y; i++) {
theSum = x += i
}
return theSum
if (x | y <0 ) {return('ERROR')}
};
// Need to add conditions for ERROR-message
// Do not edit below this line
module.exports = sumAll;