title: How to create new array of objects with globally replaced key value from a source array of objects
body: <p>I am trying to create a filter function that will create a new array of objects (newMockData) with any instance of a matching key, with its key value changed to &quot;0&quot;, from another source array of objects (mockData).  The original array of objects would look like:</p>
  <pre><code>const mockData = [
  {
      title: 'Graph 1 Title',
      data: [
          {
              option: 'Option 1',
              confClicks: 40,
              invClicks: 20,
          },
          {
              option: 'Option 2',
              confClicks: 40,
              invClicks: 20,
          },
          {
              option: 'Option 3',
              confClicks: 20,
              invClicks: 20,
          },
      ],
  },
  {
      title: 'Graph 2 Title',
      data: [
          {
              option: 'Option 1',
              confClicks: 0,
              invClicks: 20,
          },
          {
              option: 'Option 2',
              confClicks: 40,
              invClicks: 20,
          },
      ],
  },
  ];
  </code></pre>
  <p>To &quot;filter&quot; invClicks out I want to be able to create a new array with all &quot;inventoryClicks&quot; key instances with its value changing to a &quot;0&quot;.  I am assuming this requires some kind of &quot;array.map&quot; and/or &quot;array.reduce&quot;?</p>
  <p>Example of new &quot;invClicks&quot; filtered array of objects:</p>
  <pre><code>const newMockData = [
  {
      title: 'Graph 1 Title',
      data: [
          {
              option: 'Option 1',
              confClicks: 40,
              invClicks: 0,
          },
          {
              option: 'Option 2',
              confClicks: 40,
              invClicks: 0,
          },
          {
              option: 'Option 3',
              confClicks: 20,
              invClicks: 0,
          },
      ],
  },
  {
      title: 'Graph 2 Title',
      data: [
          {
              option: 'Option 1',
              confClicks: 0,
              invClicks: 0,
          },
          {
              option: 'Option 2',
              confClicks: 40,
              invClicks: 0,
          },
      ],
  },
  ];
  </code></pre>
  <p>I am really struggling with this so any help would be greatly appreciate it!!!</p>