summaryrefslogtreecommitdiff
path: root/test/language/expressions/optional-chaining/iteration-statement-while.js
blob: 80fffa9296408288c4c7b756719883292eb3f448 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2019 Google, LLC.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: prod-OptionalExpression
description: >
  optional chain in test portion of while statement
info: |
  IterationStatement
    while (Expression) Statement
features: [optional-chaining]
---*/
let count = 0;
const obj = {a: true};
while (obj?.a) {
  count++;
  break;
}
assert.sameValue(1, count);