S15.3.5_A3_T2.js (767B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: every function instance has a [[Construct]] property 6 es5id: 15.3.5_A3_T2 7 description: > 8 As constructor use new Function("arg1,arg2","var x =1; 9 this.y=arg1+arg2;return \"OK\";") 10 ---*/ 11 12 var FACTORY = new Function("arg1,arg2", "var x =1; this.y=arg1+arg2;return \"OK\";"); 13 var obj = new FACTORY("1", 2); 14 15 assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"'); 16 assert.sameValue(obj.constructor, FACTORY, 'The value of obj.constructor is expected to equal the value of FACTORY'); 17 assert.sameValue(obj.y, "12", 'The value of obj.y is expected to be "12"'); 18 19 reportCompare(0, 0);