15.2.3.5-4-1.js (937B)
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 create sets the [[Prototype]] of the created object to first parameter. 7 This can be checked using isPrototypeOf, or getPrototypeOf. 8 es5id: 15.2.3.5-4-1 9 description: > 10 Object.create sets the prototype of the passed-in object and adds 11 new properties 12 ---*/ 13 14 function base() {} 15 var b = new base(); 16 var prop = new Object(); 17 var d = Object.create(b, { 18 "x": { 19 value: true, 20 writable: false 21 }, 22 "y": { 23 value: "str", 24 writable: false 25 } 26 }); 27 28 assert.sameValue(Object.getPrototypeOf(d), b, 'Object.getPrototypeOf(d)'); 29 assert.sameValue(b.isPrototypeOf(d), true, 'b.isPrototypeOf(d)'); 30 assert.sameValue(d.x, true, 'd.x'); 31 assert.sameValue(d.y, "str", 'd.y'); 32 assert.sameValue(b.x, undefined, 'b.x'); 33 assert.sameValue(b.y, undefined, 'b.y'); 34 35 reportCompare(0, 0);