有谁知道更简洁/更优雅的方式来实现以下目标?
A = B if B?
谢谢.
我正在寻找仅引用A和B一次的解决方案.并将编译
if (typeof B !== "undefined" && B !== null) { A = B; }
或类似的其他东西.
有这个简短的帮助有以下更多可读性:
someObject[someAttribute] = (someOtherObject[someOtherAttribute] if someOtherObject[someOtherAttribute]?)
这是我的问题的动机.
coffeescript ×1