first iteration with faulty but promising loop
This commit is contained in:
parent
0c54c04f03
commit
22ca4f4958
|
@ -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
|
// Do not edit below this line
|
||||||
module.exports = sumAll;
|
module.exports = sumAll;
|
||||||
|
|
Loading…
Reference in New Issue