added loop that iterates num1 to num2 and add its value
This commit is contained in:
parent
5b8f2c93c8
commit
9921be17de
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue