if(info.type === "add") {
cate === "A" ?
// add A
: cate === "B" ?
// add B
: null;
} else if(info.type === "update") {
cate === "A" ?
// update A
: cate === "B" ?
// update B
: null
}
is similar to this. if.else
is used on the outside. Inside is a ternary expression. Is there a clear solution?
is there a way to optimize this nesting of multiple judgments?