Javascript生成器函数可以用箭头函数表示出来吗

  • Post author:
  • Post category:java


不可以。

参考:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions

Use of the

yield

keyword

The


yield


keyword may not be used in an arrow function’s body (except when permitted within functions further nested within it). As a consequence, arrow functions cannot be used as generators.



版权声明:本文为qq_28278079原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。