ITADN

Doesn't this encourage inefficient coding?

#2Openbrad4d 创建于 2023-07-06
B
brad4dcommented
One of the examples in [this gist](https://gist.github.com/nicolo-ribaudo/d264e424b618e7deaeca1d6e4f16a7c0) is: --- ```javascript if (node) { node.kind = "init"; node.type = "Property"; } ``` could be rewritten as ```javascript node?.kind = "init"; node?.type = "Property"; ``` --- This is performing the same test twice at runtime. The original was more efficient.
2 条评论