This is the code that I currently have:
if (isStandard(statement)) {
if (isPerfect(statement)) {
alert("This is a perfect palindrome.");
} else {
alert("This is a standard palindrome.");
}
} else {
alert("The statement is not a palindrome.");
}
I want to be able to turn this into a single ternary statement, where the strings inside the alert() will be the value returned. I am aware of how to do this for if-elseif-else statements, but not for nested ifs.
Aucun commentaire:
Enregistrer un commentaire