title: Can i compare two array using computed property in Vue js?
body: <p>I am so sorry if I didn't explain this clearly. I want to create an edit amenity like Airbnb. 
  I have the "Amenity" array with id, name. Then I loaded all the amenities for house_id = 2 to an array called "house_amenities". 
  What I want is when a record in house_amenities with amenites_id match with id from "Amenities" a checkbox will be ticked. 
  What i want to achieved: [1]:<a href="https://postimg.cc/bGhvGGSP" rel="nofollow noreferrer">https://postimg.cc/bGhvGGSP</a></p>
  
  <p>I tried using the computed property but haven't had any luck yet. It always returned "[Vue warn]: Error in render: "TypeError: Cannot read property 'length' of undefined"</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;table class= "table table-striped" style="overflow-y: scroll"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
          &lt;th&gt;ID&lt;/th&gt;
          &lt;th&gt;Amenities&lt;/th&gt;
          &lt;th&gt;
              &lt;span class="checkbox-custom checkbox-primary" style="padding:0px;margin:0px"&gt;
              &lt;input class="selectable-item" type="checkbox"&gt;
              &lt;label&gt;&lt;/label&gt;
              &lt;/span&gt;
          &lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody v-for = "(amenity,index) in amenitiesLst"&gt;
          &lt;tr v-for="(items,index) in houseAmenitiesLst&gt;
              &lt;td&gt;{{index+1}}&lt;/td&gt;
              &lt;td&gt;{{amenity.name}}&lt;/td&gt;
              &lt;td&gt;
                  &lt;input class="selectable-item" type="checkbox" value="check[index]"  &gt;
              &lt;/td&gt;
  
  
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>And here is vue code:</p>
  
  <pre class="lang-js prettyprint-override"><code>computed: {
      checked: function(){
          this.amenitiesLst.map(function(item){
              for(var i = 0; i &lt; this.houseAmenitiesLst.length; i++)
              {
                  if(item.id == this.houseAmenitiesLst[i].amenities_id)
                      return true;
                  else 
                      return false;    
              }
          })
      }
  },
  </code></pre>