| 1 |
// Copyright (c) 2012 Ecma International. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
Refer 11.1.5; |
| 7 |
The production |
| 8 |
PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment |
| 9 |
5.Call the [[DefineOwnProperty]] internal method of obj with arguments propId.name, propId.descriptor, and false. |
| 10 |
es5id: 11.1.5_4-5-1 |
| 11 |
description: > |
| 12 |
Object initialization using PropertyNameAndValueList |
| 13 |
(PropertyNameAndValueList , PropertyAssignment) when property |
| 14 |
(read-only) exists in Object.prototype (Step 5) |
| 15 |
---*/ |
| 16 |
|
| 17 |
Object.defineProperty(Object.prototype, "prop2", { |
| 18 |
value: 100, |
| 19 |
writable: false, |
| 20 |
configurable: true |
| 21 |
}); |
| 22 |
|
| 23 |
var obj = { prop1: 101, prop2: 12 }; |
| 24 |
|
| 25 |
assert(obj.hasOwnProperty("prop2"), 'obj.hasOwnProperty("prop2") !== true'); |