logs &quot;John Doe&quot;</code></pre>
<p>The main difference is that a stream is a function, and therefore can be composed into higher order functions.</p>
<pre><code class="language-javascript">var users = stream()

// request users from a server using the fetch API
fetch(&quot;/api/users&quot;)
    .then(function(response) {return response.json()})
    .then(users)</code></pre>
<p>In the example above, the <code>users</code> stream is populated with the response data when the request resolves.</p>
<h4 id