mirror of
https://github.com/10h30/odin-javascript-exercises.git
synced 2026-06-05 15:09:09 +09:00
sumAll solution: check if min/max are integers, not just numbers
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
const sumAll = function(min, max) {
|
const sumAll = function(min, max) {
|
||||||
if (typeof min !== "number" || typeof max !== "number") return "ERROR";
|
if (!Number.isInteger(min) || !Number.isInteger(max)) return "ERROR";
|
||||||
if (min < 0 || max < 0) return "ERROR";
|
if (min < 0 || max < 0) return "ERROR";
|
||||||
if (min > max) {
|
if (min > max) {
|
||||||
const temp = min;
|
const temp = min;
|
||||||
|
|||||||
Reference in New Issue
Block a user