iteration-statement-while.js (452B)
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 while statement 7 info: | 8 IterationStatement 9 while (Expression) Statement 10 features: [optional-chaining] 11 ---*/ 12 let count = 0; 13 const obj = {a: true}; 14 while (obj?.a) { 15 count++; 16 break; 17 } 18 assert.sameValue(1, count); 19 20 reportCompare(0, 0);