基本上,我有以下问题:
if condition A & B are true ->. do thing A
if only condition A is true -> do thing B
else -> do thing C
我尝试过这个:
const myThing = conditionA ? conditionB ? thingA :
conditionA ? thingB : thingC;
它不喜欢语法,但是我不确定它有什么问题。
(() => {
if (conditionA && conditionB) {
return thingA;
} else if (conditionA) {
return thingB;
} else {
return thingC;
}
})()