title: Best way to change a value of a property. It's within an array of arrays of objects
body: <p>So I'm trying to switch the value of selected from whatever. Value is the opposite. It's for a checkbox. Idk maybe lack sleep but I'm having the hardest time trying to figure this out. Here's the data structure. It's JSON with arrays that have objects.</p>
  <pre><code>[
      [
         {
              &quot;module&quot;: &quot;string&quot;,
              &quot;selected&quot;: false,
              &quot;name&quot;: &quot;title&quot;,
              &quot;points&quot;: [{
                      &quot;category&quot;: &quot;category1&quot;,
                      &quot;description&quot;: &quot;desc1&quot;,
                      &quot;provided&quot;: &quot;provided1&quot;
                  },
                  {
                      &quot;category&quot;: &quot;category1&quot;,
                      &quot;description&quot;: &quot;desc&quot;, 
                      &quot;provided&quot;: &quot;something&quot;
                  }
              ]
          },
          {
              &quot;module&quot;: &quot;string&quot;,
              &quot;selected&quot;: false,
              &quot;name&quot;: &quot;title_one&quot;,
              &quot;points&quot;: [{
                      &quot;category&quot;: &quot;category1&quot;,
                      &quot;description&quot;: &quot;desc1&quot;,
                      &quot;provided&quot;: &quot;provided1&quot;
                  },
                  {
                      &quot;category&quot;: &quot;category1&quot;,
                      &quot;description&quot;: &quot;desc&quot;,
                      &quot;provided&quot;: &quot;something&quot;
                  }
              ]
          },
      ],
      [...],
      [...]
  ]
  </code></pre>
  <p>My closest attempt but it's the wrong format</p>
  <pre class="lang-js prettyprint-override"><code>//checked value is the information of the checkbox and valuesArr is the entire array
  function toggleCheck(checkedValue, valuesArr) {
      return {
          value: valuesArr.map((module, i, ...values) =&gt; {
              return [
                  ...values,
                  (values[i] = module.map((x, j, ...transObj) =&gt; ({
                      ...transObj,
                      selected: x.name === checkedValue.name ?
                          !values[i][j].selected :
                          values[i][j].selected,
                  }))),
              ];
          }),
      };
  }
  </code></pre>
  <p>^^^ That above structure made it so it's</p>
  <pre><code>[
      [
          [   {},
              {},
              {}
          ],
          [...],
          [...]
      ]
  ]
  </code></pre>
  <p>I need</p>
  <pre><code>[
      [   {},
          {},
          {}
      ],
      [...],
      [...]
  ]
  </code></pre>