first iteration with faulty but promising loop

This commit is contained in:
Fredrik Uddenfeldt 2023-05-20 21:58:15 +02:00
parent 0c54c04f03
commit 22ca4f4958
1 changed files with 23 additions and 1 deletions

View File

@ -1,6 +1,28 @@
const sumAll = function() {
// First iteration pseudocode:
// Take two arguments.
// Loop between them.
// Store the value
// If negative or or non-number parameters: return ERROR
//
//
// First iteration with a faulty but promosing loop:
const sumAll = function(x, y) {
let theSum;
for (let i = x; i <=y; i++) {
x += i
}
console.log(theSum)
};
sumAll(1,10)
// Need to add conditions for ERROR-message
// Do not edit below this line
module.exports = sumAll;