Skip to content Skip to sidebar Skip to footer

Accessing Yield Inside Arrow Function

since it it not possible to create a arrow generator function, yield is never used in the context of a arrow function. var arrowGenerator = *() => { }; then you should be able

Solution 1:

The yield and yield* keywords can only be used directly inside a generator function. Your code fragment is conceptually flawed in a similar manner to:

functionf1() {
  if(someCondition) {
    f2((value) => {
       else {
         // do something
       }
    });
  }
}

or, to this:

functionf1() {
  f2((value) => {
    return someValue; // while this is legal, it doesn't cause f1 to return
  });

  codeAfterReturn();
}

Obviously, these 2 examples don't "work", and so does your code fragment.

Post a Comment for "Accessing Yield Inside Arrow Function"