2.1.40 [ECMA-262/6] Section 14.3.8 Runtime Semantics: DefineMethod

V0066: Object literal methods are created with a [[Construct]] slot

The specification states:

 14.3.8 Runtime Semantics: DefineMethod
  
     With parameters object and optional parameter functionPrototype.
  
     MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
  
         1.  Let propKey be the result of evaluating PropertyName.
         2.  ReturnIfAbrupt(propKey).
         3.  If the function code for this MethodDefinition is strict mode code, let 
             strict be true. Otherwise let strict be false.
         4.  Let scope be the running execution context’s LexicalEnvironment.
         5.  If functionPrototype was passed as a parameter, let kind be Normal; otherwise 
             let kind be Method.
         6.  Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, 
             scope, strict). If functionPrototype was passed as a parameter then pass its 
             value as the functionPrototype optional argument of FunctionCreate.
         7.  Perform MakeMethod(closure, object).
         8.  Return the Record{[[key]]: propKey, [[closure]]: closure}.

All document modes (All versions)

Object literal methods are created with a [[Construct]] slot, contrary to DefineMethod. Therefore the methods can successfully be used as the target of new expressions. In the following example, the new expression should throw a TypeError, but doesn't.

    var obj = { meth() { } };

    new obj.meth();