My problem is that I can't seem to access the second else/if statement where I try to include a clause where if a number is still in range it should still return. The syntax is all correct, I was told my brackets are improperly placed but I can't fathom where or how.
var max1020=function(a, b) {
if ((a >= 10 && a <= 20) && (b >= 10 && b <= 20)) {
if (a > b) { //comparing my a and my b and returning greater
return a;
} else if (b > a) {
return b;
} else if ((a >= 10 && a <= 20) || (b >= 10 && b <= 20)) {
if (a >= 10 && a <=20) {
return a;
} else if (b >= 10 && b <=20) {
return b;
}
} else
return 0;
}
};
Aucun commentaire:
Enregistrer un commentaire