title: Return multiple values from ES6 map() function
body: <p>Say I have something like this: </p>
  
  <pre><code>let values = [1,2,3,4]; 
  
  let newValues = values.map((v) =&gt; {
    return v *v ; 
  }); 
  
  console.log(newValues); //[1,4,9,16]
  </code></pre>
  
  <p>Pretty straight forward. </p>
  
  <p>Now what if I want to return multiple values for each of my objects? </p>
  
  <p>eg. </p>
  
  <pre><code>let values = [1,2,3,4]; 
  
  let newValues = values.map((v) =&gt; {
    return [v *v, v*v*v, v+1] ; 
  }); 
  
  console.log(newValues); //This is what I want to get 
                          //[1, 1, 2, 4, 8, 3, 9, 27, 4, 16, 64, 5]
  </code></pre>
  
  <p>I can use a reduce function </p>
  
  <pre><code>let values = [1,2,3,4]; 
  
  let newValues = values.map((v) =&gt; {
    return [v *v, v*v*v,v+1] ;
  }).reduce((a, c) =&gt; {
  
    return a.concat(c); 
  }); 
  
  console.log(newValues); 
  </code></pre>
  
  <p>But is that the best way to do this? </p>