title: How to return keys that have empty values from an array of objects as a string in JavaScript?
body: <p>I have an array of objects where some keys return an empty value. When an empty value appears I'd like to return that key as a string.</p>
  <p>For example this array:</p>
  <pre><code>'products': [{                           
          'name': 'Test product',     
          'id': '',
          'price': '',
          'brand': 'AwesomeBrand',
          'colour': 'Gray',
          'quantity': 1
         },
         {
          'name': '',
          'id': '123',
          'price': '',
          'brand': 'AwesomeBrand',
          'colour': 'Black',
          'quantity': 1
         }]
  </code></pre>
  <p>In the example above I want to return the following:</p>
  <pre><code>'id, price, name'
  </code></pre>
  <p>I've tried the following that kind of does the job. However, it still returns as an array. Then I JSON.strigify it but that returns an ugly string. I tried replacing/RegEx cleaning it however, the program I'm using uses a Sandboxed Version of JavaScript so some features are not accessible.</p>
  <p>I'm struggling to grasp the concept of accessing keys and values in an array of objects. So that is part of my problem.</p>
  <pre><code>var productArray = ecomValues || [];
  var emptyArray = [];
  
  var output = productArray.reduce(function (previousValue, currentValue, currentIndex) {
    var keys = Object.keys(currentValue).filter(function (key) {
      return !currentValue[key];/  });
  
    if (keys.length) {
      previousValue[currentIndex] = keys;
    }
  
    return previousValue;
  }, {});
  
  var emptyValues = output;
  emptyArray.push(emptyValues);
  
  </code></pre>
  <p>Anyone that can help me with my issue?</p>