title: JavaScript: Difference between .forEach() and .map()
body: <p>I know that there were a lot of topics like this. And I know the basics: <code>.forEach()</code> operates on original array and <code>.map()</code> on the new one.</p>
  
  <p>In my case:</p>
  
  <pre><code>function practice (i){
      return i+1;
  };
  
  var a = [ -1, 0, 1, 2, 3, 4, 5 ];
  var b = [ 0 ];
  var c = [ 0 ];
  console.log(a);
  b = a.forEach(practice);
  console.log("=====");
  console.log(a);
  console.log(b);
  c = a.map(practice);
  console.log("=====");
  console.log(a);
  console.log(c);
  </code></pre>
  
  <p>And this is output:</p>
  
  <pre><code>[ -1, 0, 1, 2, 3, 4, 5 ]
  =====
  [ -1, 0, 1, 2, 3, 4, 5 ]
  undefined
  =====
  [ -1, 0, 1, 2, 3, 4, 5 ]
  [ 0, 1, 2, 3, 4, 5, 6 ]
  </code></pre>
  
  <p>I can't understand why using <code>practice</code> changes value of <code>b</code> to <code>undefined</code>.<br>
  I'm sorry if this is silly question, but I'm quite new in this language and answers I found so far didn't satisfy me.</p>