没错
... Also, an ExpressionStatement cannot start with the function keyword because that might make it ambiguous with a FunctionDeclaration.
其他的xxx Statement就更别说了。
新版本也是这样,而且特别说:
NOTE Several widely used implementations of ECMAScript are known to support the use of FunctionDeclaration as a Statement. However there are significant and irreconcilable variations among the implementations in the semantics applied to such FunctionDeclarations. Because of these irreconcilable difference, the use of a FunctionDeclaration as a Statement results in code that is not reliably portable among implementations. It is recommended that ECMAScript implementations either disallow this usage of FunctionDeclaration or issue a warning when such a usage is encountered. Future editions of ECMAScript may define alternative portable means for declaring functions in a Statement context.
【 在 Goofect (1 Win TO GO!) 的大作中提到: 】
: lexical structure规范里规定好了的.
: FunctionDefinition不会出现在if else这类东西内部.如果出现了,各家怎么处理只能算附赠了.
: FunctionExpression就可以.
: 以前的js是这样,新版本的没看过,不知道...
--
FROM 123.118.111.*