15.2.3.5-4-24.js (816B)
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-24 6 description: > 7 Object.create - own enumerable accessor 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: 12 15 }; 16 17 var ConstructFun = function() {}; 18 ConstructFun.prototype = proto; 19 20 var child = new ConstructFun(); 21 Object.defineProperty(child, "prop", { 22 get: function() { 23 return { 24 value: 9 25 }; 26 }, 27 enumerable: true 28 }); 29 30 var newObj = Object.create({}, child); 31 32 assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); 33 assert.sameValue(newObj.prop, 9, 'newObj.prop'); 34 35 reportCompare(0, 0);