You can chain it together many times AND you can do nicer looking deep undefined checks
‘niceobj && niceobj.maybeUndefined && niceObj.maybeUndefined.functionOrValue’
Way cleaner than if statements, but not as clean as typescripts “?.” operator
Sorry for the poor formatting. On mobile.
Oh I just found out the “?.” operator might be coming to JS too and it’s already in Babel.
I highly encourage you to take a look!
dev.to/akirautio/optional-chaining...
Interesting. Thank you for letting us know.
It's not "might"; it's in stage 4 and will be added in ES2020.
Even better!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can chain it together many times AND you can do nicer looking deep undefined checks
‘niceobj && niceobj.maybeUndefined && niceObj.maybeUndefined.functionOrValue’
Way cleaner than if statements, but not as clean as typescripts “?.” operator
Sorry for the poor formatting. On mobile.
Oh I just found out the “?.” operator might be coming to JS too and it’s already in Babel.
I highly encourage you to take a look!
dev.to/akirautio/optional-chaining...
Interesting.
Thank you for letting us know.
It's not "might"; it's in stage 4 and will be added in ES2020.
Even better!