title: How can I perform an inject operation in CoffeeScript?
body: <p>I'm trying to do exactly this, but with CoffeeScript:</p>
  
  <pre><code># ruby:
  items.map {|item| item.price * item.quantity }.reduce(:+)
  </code></pre>
  
  <p>What I have so far:</p>
  
  <pre><code># coffeescript:
  item.price * item.quantity for item in items
  </code></pre>
  
  <p>How can I sum all the items in the array? More generally, how can I perform any operation across all the items in the array (in Ruby this would be <code>inject</code> or <code>reduce</code>)?</p>