optional-chain-expression-optional-expression.js (545B)
1 // Copyright 2019 Google, Inc. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: prod-OptionalExpression 5 description: > 6 optional chain bracket notation containing optional expresion 7 info: | 8 OptionalChain: 9 ?. [OptionalExpression] 10 features: [optional-chaining] 11 ---*/ 12 const a = undefined; 13 const b = {e: 0}; 14 const c = {}; 15 c[undefined] = 11; 16 const d = [22]; 17 18 assert.sameValue(undefined, a?.[a?.b]); 19 assert.sameValue(11, c?.[a?.b]); 20 assert.sameValue(22, d?.[b?.e]); 21 22 reportCompare(0, 0);