Using hasOwnproperty() in a nested object
<p>I have the following data:</p>

<pre><code>trace = {
  "name":"foo",
  "dataref": {
    "xdata":"n",
    "ydata":"m"
  }
};
</code></pre>

<p>I would like to check if the object has the property ydata but if I run the following command, it returns 'false'. Can you please help me with the correct syntax?</p>

<pre><code>console.log(trace.hasOwnProperty(trace.dataref.ydata));
</code></pre>

<p><a href="https://jsbin.com/jamohurota/edit?html,js,console" rel="nofollow">https://jsbin.com/jamohurota/edit?html,js,console</a></p>