Skip to content

Commit 423063b

Browse files
committed
Edited ch09.asciidoc with Atlas code editor
1 parent a94a84c commit 423063b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: ch09.asciidoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -973,11 +973,11 @@ Committing to promises isn't inherently bad; however, it's merely a cost you nee
973973

974974
Once we commit to promises, the variety of tools at our disposal is comparable to using a library that offers solutions to common flow control problems by relying on callbacks. The difference is that, for the most part, promises don't require any libraries because they're native to the language.
975975

976-
We could use ((("iterators", seealso="iteration protocol")))iterators to lazily describe sequences that don't necessarily need to be finite. Futher, their asynchronous counterpart could be used to describe sequences that require out-of-band processing, such as `GET` requests, to produce elements. Those sequences can be consumed by using a `for await..of` loop, hiding away the complexity of their asynchronous nature.
976+
We could use ((("iterators", seealso="iteration protocol")))iterators to lazily describe sequences that don't necessarily need to be finite. Further, their asynchronous counterpart could be used to describe sequences that require out-of-band processing, such as `GET` requests, to produce elements. Those sequences can be consumed by using a `for await..of` loop, hiding away the complexity of their asynchronous nature.
977977

978978
An iterator is a useful way of describing how an object is iterated to produce a sequence. When there isn't an object to describe, generators offer a way of describing standalone sequences. Implementing an iterator is the ideal way of describing how a `Movie` object should be iterated, perhaps using `Symbol.asyncIterator` and fetching information about each actor and their roles for every credited actor in a movie. Without the context of a `Movie` object, however, such an iterator would make more sense as a generator.
979979

980-
Another case where ((("generators")))generators are useful are infinite sequences. Consider the following iterator, where we produce an infinite stream of integer numbers.
980+
Another case where ((("generators")))generators are useful is infinite sequences. Consider the following iterator, where we produce an infinite stream of integer numbers.
981981

982982
[source,javascript]
983983
----

0 commit comments

Comments
 (0)