title: calculate the average : "TypeError: reduce of empty array with no initial value"
body: <p>this is my function to calculate the average of array with objects.
  But if myData is empty (no objects), I have "TypeError: reduce of empty array with no initial value"</p>
  
  <pre><code>var myData = [{"fruit1": 2,"fruit2": 2,"fruit3": 1},{"fruit1": 2,"fruit2": 1,"fruit3": 1}];
  var average =[];
                      var average = myData.reduce(function(a, b, index, self) {
  
                          var keys = Object.keys(a) ;
                          var c = {};
  
                          keys.map(function(key) {
  
                              c[key] = (a[key] + b[key] ) ;
                                  if (index + 1  === self.length ) {
                                      c[key] =( c[key] / self.length );
                              }
                                          });
  
                          return c ;
                      });
  </code></pre>