name-invoke-ctor.js (359B)
1 // Copyright (C) 2015 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: > 6 Functions declared as methods may not be used as constructors. 7 es6id: 14.3.8 8 ---*/ 9 10 var obj = { method() {} }; 11 assert.throws(TypeError, function() { 12 new obj.method(); 13 }); 14 15 reportCompare(0, 0);