Two streams often need to work together to produce the values you’ll need. This lesson shows how to use an input stream and an interval stream together and push an object with both values through the stream.
at first I didn't understand the semantics of map here and in the previous example. Map in Rxjs is similar to the Array.prototype.map, but the former treats the whole observable as an iterable, whereas the second treats an array as iterable.
Yes, you can think of an Observable as being an array of indeterminate length, whose values are delivered one at a time, over time, instead of all at once. In both cases, map
does the same thing: it transforms each value somehow to populate a new array. But since the original array is delivered over time for an Observable, so is the mapped array.