I am trying to run a block of code that is series of IF ELSE IF statements, that checks to see if certain conditions are true.
if (2 > 1) {
return true;
}
else if (3 > 1) {
return true;
}
else if (4 > 1) {
return true;
}
else {
alert('Not all conditions are true')
}
It is working fine, but I want to add a function at the end, if all the conditions are true, In the code below I added the function, but now it seems to run the function without checking all the conditions first
if (2 > 1) {
return true;
}
else if (3 > 1) {
return true;
}
else if (4 > 1) {
return true;
}
else {
alert('Not all conditions are true')
}
// Run this function after checking all the conditions are true
allConditionsTrue();
I think I am getting confused with where the function should be placed.
Any help is greatly appreciated :)
Aucun commentaire:
Enregistrer un commentaire