lgcl-and-assignment-operator-non-writeable.js 685 B

1234567891011121314151617181920212223
  1. // Copyright (c) 2020 Ecma International. All rights reserved.
  2. // This code is governed by the BSD license found in the LICENSE file.
  3. /*---
  4. esid: sec-assignment-operators-runtime-semantics-evaluation
  5. description: >
  6. Strict Mode - TypeError is not thrown if the LeftHandSide of a Logical
  7. Assignment operator(&&=) is a reference to a data property with the
  8. attribute value {[[Writable]]:false} and PutValue step is not reached.
  9. flags: [onlyStrict]
  10. features: [logical-assignment-operators]
  11. ---*/
  12. var obj = {};
  13. Object.defineProperty(obj, "prop", {
  14. value: 0,
  15. writable: false,
  16. enumerable: true,
  17. configurable: true
  18. });
  19. assert.sameValue(obj.prop &&= 1, 0, "obj.prop");