[Solved] accessing yield inside arrow function [closed]


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:

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

or, to this:

function f1() {
  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.

3

solved accessing yield inside arrow function [closed]