| 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 |
es5id: 15.2.3.5-4-22 |
| 6 |
description: > |
| 7 |
Object.create - own enumerable data property that overrides an |
| 8 |
enumerable inherited data property in 'Properties' is defined in |
| 9 |
'obj' (15.2.3.7 step 5.a) |
| 10 |
---*/ |
| 11 |
|
| 12 |
var proto = {}; |
| 13 |
proto.prop = { |
| 14 |
value: "abc" |
| 15 |
}; |
| 16 |
|
| 17 |
var ConstructFun = function() {}; |
| 18 |
ConstructFun.prototype = proto; |
| 19 |
|
| 20 |
var child = new ConstructFun(); |
| 21 |
child.prop = { |
| 22 |
value: "bbq" |
| 23 |
}; |
| 24 |
var newObj = Object.create({}, child); |
| 25 |
|
| 26 |
assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); |
| 27 |
assert.sameValue(newObj.prop, "bbq", 'newObj.prop'); |