【发布时间】:2021-11-23 05:25:08
【问题描述】:
一个非常简单的打字问题,我需要帮助
如果不使用 if 语句,我如何有条件地为常量变量赋值
const myConstant = myProduct.productId;
我希望如果 myProduct 中的 productId 为空 (""),它会将 myConstant 的变量分配给“No Product”,我希望不使用 if 语句来执行此操作。
谢谢
我该怎么做呢。
【问题讨论】:
标签: javascript typescript conditional-statements