mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
e1e2f669f6
PR-URL: https://github.com/nodejs/node/pull/29564 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
20 lines
298 B
JavaScript
20 lines
298 B
JavaScript
/*---
|
|
esid: prod-OptionalExpression
|
|
features: [optional-chaining]
|
|
---*/
|
|
|
|
const obj = {
|
|
a: {
|
|
b: 22
|
|
}
|
|
};
|
|
|
|
function fn () {
|
|
return {};
|
|
}
|
|
|
|
setTimeout((err) => {
|
|
// OptionalExpression (MemberExpression OptionalChain) OptionalChain
|
|
if (obj?.a?.b === 22) throw Error('an exception');
|
|
}, 5);
|