loading...

re: Optional Chaining Has Arrived! VIEW POST

TOP OF THREAD FULL DISCUSSION
re: arrays are objects! { a: 1 }?.['a'] and [1]?.[0] are the same. Also, optional chaining does not shadow reference errors! If functionDoesNotExist i...
 

Yes, arrays are objects, but both are valid syntaxes and worth sharing.

In terms of the function I’d invite you to look directly at the proposal github.com/tc39/proposal-optional-....
The idea is that FunctionDoesNotExist is null, undefined or not a function. Using ?.() to call it will prevent an error from being thrown.
If you’re saying that is not being declared at all will still throw an error then you’re correct and I could be more clear about that.

code of conduct - report abuse