Hi Today I’ve learned about JavaScript generators....
# coroutines
p
Hi Today I’ve learned about JavaScript generators. In such generator you can call
yield
with parameter whcih will be the next value of a sequence. Morever such
yield
can return value provided in iterating code. Something like this:
Copy code
// in generator named `values`
x = yield(123)
// x is now "abc"

// and in other place in code
y = values.next("abc")
// y is now 123