how can i check a js chain var exists ? any simple method to check ,or usign jquery
please see codes bellow:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
// how can i check a var exists ?
// the code bellow will return undefined
// a is undefined
// a.b is undefined --- when a exists, then I need to check a.b
// a.b.c is undefined ...
// a.b.c.d is undefined
// sometimes I need to check if some property of an object exists or is true, and I don't even know the object exists or not
// how can I check it then ?
if(a.b.c.d){
alert('yes');
}
</script>