可选链接(obj?.param1?.param2
)似乎是一个很好的功能,我真的很想看到它的实现,并最终摆脱嵌套的ifs、任意函数和其他不适合这样简单操作的功能.
但有一个问题,它不起作用.我更新到 node 12,但仍然出现错误:
var dude = res?.param?.params[0]
SyntaxErr或: Unexpected token '.'
或
var dude = res.param?.params[0]
SyntaxErr或: Unexpected token '.'
有什么问题吗?
Do I need to change some language config 或 download a library to enable this feature? Or is it simply not out yet?