iteration-statement-do.js 448 B

123456789101112131415161718
  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. do Statement while (OptionalExpression)
  10. features: [optional-chaining]
  11. ---*/
  12. let count = 0;
  13. const obj = {a: true};
  14. do {
  15. count++;
  16. break;
  17. } while (obj?.a);
  18. assert.sameValue(1, count);