Can these nested 'if typeof(bla) else' statements be done shorter?
<p>I have a piece of code that goes like this. This piece of code works but it looks horrible.</p>

<pre><code>if(typeof(d.object) != "undefined"){
  if(typeof(d.object.property) != "undefined"){
    if(typeof(d.object.property.length) != "undefined"){
      // do the code
    }
    else alert("error");
  }
  else alert("error");
}
else alert("error");
</code></pre>

<p>Is there any way this can be rewritten so it does the same but more efficient. Especially because the errors are all the same.</p>
