I have nested if else statements, which I added below in two statements, Instead of having a lot of lines I am looking to shorthand it.
Can anyone help me out.
In Below statements in Statement1: a&&b and C&&d, a,b,c,c are arrays.
In statement2 its a keywords.
Statement1:
if((a && b)!== -1){
abc ="hai"
}
else if ((c && d)!== -1) {
abc="hello"
}
else{
abc="Hurray"
}
Statement 2:
if(a==="abc"){
if(bb==="def"){
amd ="hello"
}
else if(bb==="ghi"){
amd ="hai"
}
else{
amd = "Hurray";
}
}
else if(a==="qwe"){
if(aaa==="ddd") {
amd = "Hurray Hi";
}
else{
amd = "Hurray bye";
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…