Keywords as method names

Jason Orendorff jason.orendorff at
Wed Aug 21 16:13:35 PDT 2013

The ES6 draft says:

    MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
    PropertyName : IdentifierName

This means a method name can be a keyword: `obj = {if() {}}`. This is
consistent with other property names (`{if: true}` is allowed), but
inconsistent with other function names (`function if(){}` is not

Why not allow keywords as function names, too?


More information about the es-discuss mailing list