title: Check to see if child object exists in JavaScript object
body: <p>In JavaScript, I am building an object.  Inside a loop I need to check to see if the root object already contains a child object, and if not, I need to add it.</p>
  
  <pre><code>childObjectName = this.name.split('.')[1];
  </code></pre>
  
  <p>Now, how do I check to see if my root object, <code>myObject</code> already contains a child by the name of whatever is contained in <code>childObjectName</code>?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I think perhaps my OP wasn't very clear. Sorry about that.</p>
  
  <p>Let's say <code>childObjectName</code> ends up having a value of "ThisName".  Now, I want to check and see if <code>myObject</code> already contains a child object called "ThisName".  And as this is in a loop, I need to be able to check for ANY name.</p>
  
  <p>I hope that makes more sense?</p>
  
  <p><strong>EDIT 2:</strong></p>
  
  <pre><code>{  
     "myObject":{  
        "CampaignType":{  
           "Exclusive":25,
           "Shared":6
        }
     }
  }
  </code></pre>
  
  <p>Ok, now, let's say the var <code>childObjectName</code> is equal to "CampaignType".  In this case, I need to get TRUE when looing to see if <code>myObject</code> contains <code>childObjectName</code>.  </p>
  
  <p>But, let's say <code>childObjectName</code> is equal to "FooBar". In that case, I would need to get FALSE.</p>