【发布时间】:2013-01-19 12:43:16
【问题描述】:
如果使用 if/else 语句而不是三元语句,这个块会是什么样子?
返回值 == null ?名称.local ? attrNullNS : attrNull : typeof 价值===“功能”?名称.local ? attrFunctionNS : attrFunction : 名称.local ? attrConstantNS : attrConstant;
(我想确定在处理另外 15 个类似的块之前我这样做是正确的......理想情况下,我想用正则表达式替换所有这些块,但似乎没有方法?Replace conditional operator with if/else automatically?)
【问题讨论】:
标签: javascript conditional-operator