3 ms·
Right, because while b and c will be undefined, they are taken from an existing array, not from null/undefined. This will throw var [a, b, c] = null and t
by vimslayer 8y ago
Right, because while b and c will be undefined, they are taken from an existing array, not from null/undefined.
This will throw
var [a, b, c] = null
and this (destructing a nested array)
var [[a]] = []
the point of the "elvis" ?. operator is to make accessing properties _of_ optional values or other optional properties easier.
"Either way, I'd highly recommend just using TypeScript."
Sure, I'd recommend that too, but in this case it "only" helps us by moving the error from runtime to compile-time, nested optional property access remains ugly in the TS world, too. The ?. operator will come to TypeScript as soon as it comes to EcmaScript.