added loop that iterates num1 to num2 and add its value

This commit is contained in:
Jared Ramon Elizan 2022-07-15 09:07:07 +08:00
parent 5b8f2c93c8
commit 9921be17de
1 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,10 @@
const sumAll = function() { const sumAll = function(num1, num2) {
let sum = 0;
for( let i = num1; i <= num2; i++){
sum+=i;
}
return sum;
}; };
sumAll(1, 4);
// Do not edit below this line // Do not edit below this line
module.exports = sumAll; module.exports = sumAll;