非标准
该特性是非标准的,请尽量不要在生产环境中使用它!
概述
判断一个函数是否是一个生成器.
语法
fun.isGenerator()
描述
该方法用来判断一个函数是否是一个生成器.
例子
function f() {}
function* g() {
yield 42;
}
console.log("f.isGenerator() = " + f.isGenerator());
console.log("g.isGenerator() = " + g.isGenerator());
上面代码的输出结果为
f.isGenerator() = false g.isGenerator() = true