title: What is the performance difference between _.map and _.forEach in Lodash?
body: <p>what is the best way to scroll through a list of _.map and _.forEach in lodash?
  I do not need the return value but I only do something inside the loop.</p>
  
  <p>In terms of performance, which is the difference between the two functions?</p>
  
  <pre><code>a = []
  b = []
  list = response._source.carico_scarico
  if angular.isDefined(list)
    _.forEach(list, (cs) -&gt;
      if cs.qta &gt;= 0 then a.push cs
      if cs.qta &lt; 0 then b.push cs
    )
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>a = []
  b = []
  list = response._source.carico_scarico
  if angular.isDefined(list)
    _.map(list, (cs) -&gt;
      if cs.qta &gt;= 0 then a.push cs
      if cs.qta &lt; 0 then b.push cs
    )
  </code></pre>