mirror of
https://github.com/10h30/odin-javascript-exercises.git
synced 2026-07-11 18:55:59 +09:00
remove class based exercises
This commit is contained in:
+17
-2
@@ -1,5 +1,20 @@
|
||||
var sumAll = function() {
|
||||
|
||||
var sumAll = function(a, b) {
|
||||
if (a > b) {
|
||||
let temp = a
|
||||
a = b
|
||||
b = temp
|
||||
}
|
||||
if (
|
||||
a < 0 || b < 0 ||
|
||||
typeof a != 'number' || typeof b != 'number'
|
||||
) {
|
||||
return 'ERROR'
|
||||
}
|
||||
let sum = 0
|
||||
for(let i = a; i < b + 1; i++) {
|
||||
sum += i
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
module.exports = sumAll
|
||||
|
||||
Reference in New Issue
Block a user