iteration-statement-for-in.js (516B)
1 // Copyright 2019 Google, LLC. 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 in test portion of do while statement 7 info: | 8 IterationStatement 9 for (LeftHandSideExpression in Expression) Statement 10 features: [optional-chaining] 11 ---*/ 12 const obj = { 13 inner: { 14 a: 1, 15 b: 2 16 } 17 }; 18 let str = ''; 19 for (const key in obj?.inner) { 20 str += key; 21 } 22 assert.sameValue('ab', str); 23 24 reportCompare(0, 0);