lgcl-or-assignment-operator-non-extensible-strict.js (687B)
1 'use strict'; 2 // Copyright (c) 2020 Ecma International. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-assignment-operators-runtime-semantics-evaluation 7 description: > 8 Strict Mode - TypeError is thrown if The LeftHandSide of a Logical 9 Assignment operator(||=) is a reference to a non-existent property 10 of an object whose [[Extensible]] internal property is false. 11 flags: [onlyStrict] 12 features: [logical-assignment-operators] 13 14 ---*/ 15 16 var obj = {}; 17 Object.preventExtensions(obj); 18 19 assert.throws(TypeError, function() { 20 obj.prop ||= 1; 21 }); 22 assert.sameValue(obj.prop, undefined, "obj.prop"); 23 24 reportCompare(0, 0);