odin-js-fundamentals-part-4/05_sumAll/sumAll.js

11 lines
184 B
JavaScript
Raw Normal View History

2024-01-05 20:37:06 +00:00
const sumAll = function(a, b) {
let sum = 0;
for (let i = a; i <= b; i++) {
sum += i;
}
return sum;
};
// Do not edit below this line
module.exports = sumAll;