I was wondering whether in newer versions of javascript there is an alternative way of the dot notation which returns an object like nil, but still can use other .dot elements. I have code like this:
var a = venue.photos.groups[0].items[0].prefix;
and I get an error like
Cannot read property 'items' of undefined
and looking for something similar to
if (venues.photos && venue.photos.groups && venue.photos.groups[0].items ) {
a=venue.photos.groups[0].items[0].prefix;
} else {
a=null;
}
For those who know objective C i would like something of the Form:
NSObject * val = [[a b] c] .. n]