title: how to compare two inner array of object from javascript
body: <p>I have two arrays of an object X and y, form <code>x</code> <code>value</code> array <code>[&quot;N&quot;,&quot;Y&quot;]</code>, I need to filter the <code>y</code> array options value, based on that I need to return the <code>y</code> array, I had tried with this:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const x = [{"application":"Collect","attr":[{"name":"document","value":["N","Y"],"disabled":true}, {"name":"video","value":["Y"],"disabled":false}]}]
  const y = [{"name":"document","options":[{"name":"Yes","value":"Y"},{"name":"No","value":"N"},{"name":"view", value:"view"}]}]
  
  const iArr = x[0].attr.map(m =&gt; {
    m.value.map(o =&gt; {
      y.map(yl =&gt; {
        yl.options.filter(s =&gt; {
          if (o === s.value) {
            console.log(s)
          }
        })
      })
    })
  })
  
  console.log(iArr)</code></pre>
  </div>
  </div>
  </p>
  <p>my output should be</p>
  <pre><code>const result = [{&quot;name&quot;:&quot;document&quot;,&quot;options&quot;:[{&quot;name&quot;:&quot;Yes&quot;,&quot;value&quot;:&quot;Y&quot;},{&quot;name&quot;:&quot;No&quot;,&quot;value&quot;:&quot;N&quot;}]}]
  </code></pre>