title: Evenly chunk an array using lodash
body: <p>I got <code>countries.json</code> which I am chunking to display in 4 columns as per specification.</p>
  
  <p>I am looking at a solution where the array elements are evenly distributed to all four arrays.</p>
  
  <p><strong>Sample JSFIDDLE</strong> <a href="https://jsfiddle.net/5tkjLs7b/" rel="nofollow">https://jsfiddle.net/5tkjLs7b/</a></p>
  
  <p>If I remove one country from the json data, I will end-up with 6 arrays. But the expected is only 4 arrays.</p>
  
  <p>Also the data should be evenly distributed.</p>
  
  <blockquote>
    <p>Example : I am getting 63 items*4 arrays + 3 items*1 array for full
    country.json.</p>
  </blockquote>
  
  <pre><code>var countries = [ 
    {"name": "Afghanistan", "code": "AF"}, 
    {"name": "Åland Islands", "code": "AX"}, 
    {"name": "Albania", "code": "AL"}, 
    {"name": "Algeria", "code": "DZ"}, 
    {"name": "American Samoa", "code": "AS"}, 
    {"name": "AndorrA", "code": "AD"}, 
    {"name": "Angola", "code": "AO"}, 
    {"name": "Anguilla", "code": "AI"}, 
    {"name": "Antarctica", "code": "AQ"}, 
    {"name": "Antigua and Barbuda", "code": "AG"}, 
    {"name": "Argentina", "code": "AR"}, 
    {"name": "Armenia", "code": "AM"}];
  
    chunkedCountries = _.chunk(countries, countries.length/4)
    console.log(chunkedCountries);
  </code></pre>