title: Compare nested objects in JavaScript and return keys equality
body: <p>I have two nested objects <code>obj1</code> and <code>obj2</code> and I want to compare them and the recursively return an object that for each nested key has a equality-like boolean flag</p>
  
  <p>So for a given <code>obj1</code> like</p>
  
  <pre><code>obj1 = {
    prop1: 1,
    prop2: "foo",
    prop3: {
      prop4: 2,
      prop5: "bar" 
    }
  }
  </code></pre>
  
  <p>and the <code>obj2</code> like</p>
  
  <pre><code>obj2 = {
        prop1: 3,
        prop2: "foo",
        prop3: {
          prop4: 2,
          prop5: "foobar" 
        },
        prop6: "new"
      }
  </code></pre>
  
  <p>it should return</p>
  
  <pre><code>equality = {
       prop1: false,
       prop2: true,
       prop3 : {
         prop4: true,
         prop5: false
       },
       prop6: false
     }
  </code></pre>
  
  <p>If an object has a new property, like <code>obj2.prop6</code>, then the equality will be <code>equality.prop6 = false</code>.</p>
  
  <p>For non-nested object a simple keys comparison solutions is here <a href="https://stackoverflow.com/questions/46930387/get-the-property-of-the-difference-between-two-objects-in-javascript/46930709?noredirect=1#comment97878361_46930709">Get the property of the difference between two objects in javascript</a>
  While to recursively compare nested objects it is showed here <a href="https://stackoverflow.com/questions/30476150/javascript-deep-comparison-recursively-objects-and-properties">JavaScript: Deep comparison recursively: Objects and properties</a></p>