const result = a ? b : c

其中 a、b、c 三个变量即“三元”,需要注意执行顺序的问题,如果逻辑过于复杂则建议使用 if else 便于理解。