Tuesday, June 4, 2024
188
rated 0 times [  194] [ 6]  / answers: 1 / hits: 120889  / 10 Years ago, fri, december 26, 2014, 12:00:00

That is, how do I express


function *(next) {}

with arrow syntax? I've tried all the combinations I could think of, and I can't find any documentation on it.


(I am currently using Node.js v0.11.14.)


More From » ecmascript-6

 Answers
3

Can I use ES6's arrow function syntax with generators?



You can't. Sorry.


According to MDN



The function* statement (function keyword followed by an asterisk) defines a generator function.



From a spec document (my emphasis):



The function syntax is extended to add an optional * token:



FunctionDeclaration: "function" "*"? Identifier "(" FormalParameterList? ")" 
"{" FunctionBody "}"

[#68376] Tuesday, December 23, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sienad

Total Points: 208
Total Questions: 100
Total Answers: 77

Location: Taiwan
Member since Mon, Sep 6, 2021
3 Years ago
;