Skip to content

Instantly share code, notes, and snippets.

@dreadjr
Last active December 11, 2015 20:48
Show Gist options
  • Save dreadjr/4657730 to your computer and use it in GitHub Desktop.
Save dreadjr/4657730 to your computer and use it in GitHub Desktop.
if (obj) {
var levelOne = obj.levelOne;
if (levelOne) {
var levelTwo = levelOne.levelTwo;
if (levelTwo) {
var propertyValueOrUndefined = levelTwo.property;
if (propertyValueOrUndefined)
console.log(propertyValueOrUndefined);
}
var levelOneArray = levelOne.levelOneArray;
if (levelOneArray && levelOneArray.length) {
console.log(levelOneArray[0]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment