Nothing displaying in console when using console.log with if statements in for loops : <p>I have two objects:</p>

<pre><code>var obj = { first: "Romeo", last: "Montague" };
var search = { last: "Montague" };
</code></pre>

<p>My goal is to find if the second object (<code>search</code>) is present in the first one, and <code>console.log</code> it if it is.</p>

<p>First, I get the keys of both objects:</p>

<pre><code>var objKeys = Object.keys(obj);
var searchKeys = Object.keys(search);
</code></pre>

<p>Then I am trying to iterate trough both keys and compare them, and if they match, <code>console.log</code> the value from the first obj (<code>obj</code>).</p>

<pre><code>//for every key in object
for(var x = 0; x &lt; objKeys.lenght; x++) {
  //for every key in search
  for(var y = 0; y &lt; searchKeys.length; y++) {
    //see if a key matches
    if(searchKeys[y] == objKeys[x]) {
        //see if the value matches
        if(obj[objKeys[x]] == search[searchKeys[y]]) {
        console.log(obj[objKeys[x]]);
      }  
      else {
        console.log("value not found");
      }
    }
    else {
        console.log("key not found");
    }
  } 
}
</code></pre>

<p>Now when I run this code, nothing displays in the console. No errors or messages. Can anybody point out what I'm doing wrong?</p>

<p>I've create a <a href="https://jsfiddle.net/gdbw58r8/2/" rel="nofollow">jsFiddle</a> of this code, if you want to tinker.</p>
