I'm working with nodeJs and I would like to assign a sub value to an object without to know if the «three» exist.
E.g : I would like to assign True to «global.proc.trackingMarketExport.started» without check if :
- proc exist in global
- trackingMarketExport exist in global.proc
- ....
Actually I'm writing this :
!global?.proc && ( global.proc = {})
!global.proc?.trackingMarketExport && ( global.proc.trackingMarketExport = { started: false })
For sample :
global?.proc?.trackingMarketExport?.started = true;
Thanks in advance for your help