//sample solution
function tennisSet(score1, score2) {
if(score1 > 7 || score2 > 7){
return false;
} else if(score1 == 7 && score2 == 7){
return false;
}else if(score1 == 7 || score2 == 7){
if(score1==7 && score2 < 5){
return false;
} else if(score2==7 && score1 < 5){
return false;
} else {
return true;
}
} else if(score1 < 7 || score2 <7){
if(score1 == 5 && score2 == 5){
return false;
} else if(score1 == 6 || score2 == 6){
if(score1 == 5 || score2 == 5){
return false;
} else {
return true;
}
} else {
return false;
}
}
}
No comments:
Post a Comment