changed the order of if conditions
it flows better logically to first check if the inputs are a number than to check if they are negative.
This commit is contained in:
parent
3b51e5dbef
commit
f9a972ec16
1 changed files with 1 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
const sumAll = function(min, max) {
|
const sumAll = function(min, max) {
|
||||||
if (min < 0 || max < 0) return "ERROR";
|
|
||||||
if (typeof min !== "number" || typeof max !== "number") return "ERROR";
|
if (typeof min !== "number" || typeof max !== "number") return "ERROR";
|
||||||
|
if (min < 0 || max < 0) return "ERROR";
|
||||||
if (min > max) {
|
if (min > max) {
|
||||||
const temp = min;
|
const temp = min;
|
||||||
min = max;
|
min = max;
|
||||||
|
|
Loading…
Reference in a new issue