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

28 lines
460 B
JavaScript

// 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+1; i <=y; i++) {
theSum = x += i
}
return(theSum)
};
// Need to add conditions for ERROR-message
// Do not edit below this line
module.exports = sumAll;