title: Returning from Array.prototype.map() is not consistent
body: <p>I'm trying to get this output <code>['1', '12', '123']</code> from:</p>
  <pre><code>   getSubstrings('123');
  
     function getSubstrings(string) {
        let array = string.split('');
        let subarray = [];
        return array.map(element =&gt; {
          subarray.push(element);
          console.log(subarray)       //this gets me ['1'], then ['1','2'] ...
          return subarray;            //but this is not returning the same as in console.log(subarray)   
        });
        
      }
  </code></pre>
  <p>I know I can get the result I want by adding <code>.join('')</code> to the end of <code>subarray</code>. My question is not about how to get <code>['1', '12', '123']</code> But, why returning the same subarray as the one being outputted on the console would result in <code>[[1','2','3'], ['1','2','3'], ['1','2','3']]</code> instead of <code>[[1], [1,2], [1,2,3]]</code> weird enough, the output from the console.log(subarray) is not the same as the returning subarray populated in the .map() Am I missing something here? Thanks in advance.</p>