title: Javascript: How to filter an object array and sum result
body: <p>I have an object array: </p>
  
  <pre><code>var example = [{a:1, b:2, c:3}, {a:4, b:5, c:6}, {a:7, b:8, c:9}]
  </code></pre>
  
  <p>I am trying to add all values that don't correspond with <code>c</code>.</p>
  
  <ul>
  <li><p>I've managed to filter out a row, which wasn't what I was after, with console.log(test.filter(x => x.c > 3));</p></li>
  <li><p>I've also tried a data query and chaining .ne("c") to it, but this didn't work.</p></li>
  </ul>
  
  <p>I have managed to find the sum of an object array, but it doesn't omit the elements corresponding with "c". The code for that is:</p>
  
  <pre><code>var example = [{a:1, b:2, c:3}, {a:4, b:5, c:6}, {a:7, b:8, c:9}]
  var sumobjects
  sumobjects = example.map(y =&gt; Object.keys(y).reduce((x,z) =&gt; x + y[z], 0));
  const reducer = (accumulator, currentValue) =&gt; accumulator + currentValue;
  const sumexample = sumobjects.reduce(reducer)
  console.log(sumexample);
  </code></pre>
  
  <p>My current code is looking like this:</p>
  
  <pre><code>var example = [{a:1, b:2, c:3}, {a:4, b:5, c:6}, {a:7, b:8, c:9}]
  function filtration (arr) {
  
   var filteredsum = 0
   for (let i = 0; i &lt; arr.length; i++) {
   for (let j = 0; j &lt; arr[i].length; j++) {
   for(let k = 0; k &lt; arr[i][j].length &amp;&amp; arr[i][j] !== "c"; k++)
              filteredsum += arr[i][j]            
          }
      }   
   return(filteredsum);
  }
  console.log(filtration(example));
  </code></pre>
  
  <p>The answer should be one single number, being <code>27</code>.</p>
  
  <p>The code I currently have is outputting <code>0</code>, so I figure that instead of omitting the property "c" from the sum, it's finding <code>c</code> and then omitting the entire object from the object array.</p>
  
  <p>EDIT: The object array above is a simplified version of the object array I'm actually working with. The actual object array is not limited to the properties a, b and c. It has about 350 different properties. So code that adds a and b and c by actually stating a, b and c isn't going to be a good option for me.</p>