check if value exists in mulitdimensional array and return boolean
<p>I have seen many posts about searching nested arrays in javascript but none of them have a way to tell if an item does not exist in the array.</p>

<p>this may sound confusing so here are some examples:</p>

<p>I have 2 arrays <code>oldArray</code> and <code>newArray</code></p>

<p>structured like this:</p>

<pre><code>array(
      [0]=&gt;array([name]:"name"
           [location]:"location")
      [1]=&gt;array([name]:"name2"
           [location]:"location2")
 )
</code></pre>

<p>both arrays are structured this way.</p>

<p>I need to be able to know which names exist in the old array and not in the new and vice versa.</p>

<p>here is what I have tried:</p>

<pre><code> var name= oldArray[key]['name'];

   for (var key in oldArray) {
       for(var i= 0, len = newArray.length; i &lt; len; i++){
                if(newArray[i]['name'] == name){
                          //push to array
                }
                 else{
                      //push to different array
                 }
       }
 }
</code></pre>

<p>this way I will have an array that contains all names that exist in both arrays and an array that only contains names that exist in the oldArray..</p>

<p>this doesn't seem to work because it is a 1 to 1 comparison. the first array is correct but the array that should only contain the names that exist in the old array is not correct.</p>
