Javascript - How do I access properties of objects nested within other Objects
<p>Within the context of React/Meteor I'm running into some surprising difficulty extracting information from a nested Javascript Object.</p>

<p>My data structure looks like this (taken from inspection in chrome dev tools:</p>

<pre><code>Object {
id: "138451",
name: "Attendant",
 key: "Taiwan", 
defaultAnimation: 2, 
position: Object
 {
latitude:0.5,
longitude: -0.14
}
</code></pre>

<p>Within my React ComponentWillRecieveProps I see the following behaviour </p>

<pre><code>componentWillReceiveProps(nextProps){
  console.log("its getting props");
  console.log(nextProps.markers[0]) // this works
  console.log(nextProps.markers[0].position) //so does this
  console.log(nextProps.markers[0].position.longitude) //breaks 
</code></pre>

<p>I also tried setting 
 <code>var positionObject = nextProps.markers[0].position</code> but interrogating this object also fails. Please highlight my Javascript noobish mistake.</p>

<p>Thanks!</p>