List comprehensions are incredible.
But they&#x27;re just syntactic sugar for map() and filter() and lambdas.<p>Python&#x27;s<p><pre><code>  prev = [1,2,3,4]
  next = [x * 2 for x in old]
</code></pre>
Is the same as javascript&#x27;s<p><pre><code>  prev = [1,2,3,4];
  next = prev.map(x =&gt; x * 2);
</code></pre>
Python&#x27;s<p><pre><code>  next = [x for x in prev if x % 2 == 0]
</code></pre>
is the same as javascript&#x27;s<p><pre><code>  next = prev.filter(x =&gt; x % 2 === 0);
</code></pre>
And finally, python&#x27;s<p><pre><code>  next = [x * 2 for x in prev if x % 2 == 0]</code></pre>
is the same as<p><pre><code>  next = prev.filter(x =&gt; x % 2 == 0).map(x =&gt; x * 2);
</code></pre>
It could be nice to have a &quot;mapIf&quot; function that accepts a mapping and a predicate, but I think the extra verbosity makes the above code easier to understand.<p><pre><code>  next = prev.mapIf(x =&gt; x * 2, x =&gt; x % 2 == 0);</code></pre>