p>
<p>Thanks to these error propagation semantics, it&#39;s easy to keep each function small and testable without sprinkling <code>try</code>/<code>catch</code> blocks everywhere.</p>
<hr>
<h3 id="shorthands"><a href="#shorthands">Shorthands</a></h3>
<p>Sometimes, you already have a value, but want to wrap it in a Promise. It&#39;s for this purpose that <code>Promise.resolve</code> and <code>Promise.reject</code> exist.</p>
<pre><code class="language-javascript">// suppose this list came from localStorage
v