Over the years there have been multiple answers to this question, evolving from some clunky code.
In 2022 is there a one liner or improved way to get the condition that failed in a multiple if
scenario?
example one, myVarTwo
fails
if (( myVarOne == "alpha") && ( myVarTwo == "beta") && ( myVarThree == "cappa"){
// do stuff
}else{
console.log("failed at ...)
}
example two, myVarThree
fails
if (( myVarOne == "alpha") || (( myVarTwo == "beta") && ( myVarThree == "cappa")){
// do stuff
}else{
console.log("failed at ...)
}
I am assuming the conditions test stops at the first fail.