非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。

The non-standard isGenerator() method used to determine whether or not a function is a generator . It has been removed from Firefox starting with version 58.

句法

fun.isGenerator()
					

返回值

A 布尔 indicating whether or not the given function is a generator .

描述

isGenerator() method determines whether or not the function fun generator . It was part of an early Harmony proposal, but has not been included in the ECMAScript 2015 specification.

范例

function f() {}
function* g() {
  yield 42;
}
console.log('f.isGenerator() = ' + f.isGenerator()); // f.isGenerator() = false
console.log('g.isGenerator() = ' + g.isGenerator()); // g.isGenerator() = true
					

规范

Not part of any standard.

浏览器兼容性

Not supported anywhere. Historically supported in Firefox 5 till 58.

另请参阅

元数据

  • 最后修改: