[SCRIPT]-VERIFYING IF A DEEP PROPERTY EXISTS IN AN OBJECT
VERIFYING IF A DEEP PROPERTY EXISTS IN AN OBJECT
use a resolver:
function resolve(start) {
return [].slice.call(arguments, 1).reduce(function(obj, prop) {
return obj && obj[prop];
}, start);
}
resolve(response, "objects", 0, "images", 0, "url");
if it returns undefined, then something along the way went bad...