非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。
Obsolete since Gecko 58 (Firefox 58 / Thunderbird 58 / SeaMonkey 2.55)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
The legacy generator function was a SpiderMonkey-specific feature, which is removed in Firefox 58+. For future-facing usages, consider using
function*
.
legacy generator function statement declares legacy generator functions with the specified parameters.
还可以定义函数使用
Function
constructor with
functionBody
and at least one
yield
expression, and a
legacy generator function expression
.
function name([param,[, param,[..., param]]]) {
[statements]
}
name
函数名称。
param
The name of an argument to be passed to the function. A function can have up to 255 arguments.
statements
yield
表达式。
An overview of the usage is available on the Iterators and Generators 页面。
Supported nowhere.
Generator
yield
function
函数表达式
Function
function*
function* 表达式
GeneratorFunction