is yield keyword onlye used for returning promises code example
Example: javascript yield
function* foo(index) {
while (index < 2) {
yield index;
index++;
}
}
const iterator = foo(0);
console.log(iterator.next().value);
// expected output: 0
console.log(iterator.next().value);
// expected output: 1