Skip to content

Instantly share code, notes, and snippets.

@jpitchardu
Created May 23, 2018 16:32
Show Gist options
  • Save jpitchardu/18b554bfbc1e50f731a430397e857455 to your computer and use it in GitHub Desktop.
Save jpitchardu/18b554bfbc1e50f731a430397e857455 to your computer and use it in GitHub Desktop.
Deep null-check in javascript
console.log( obj && obj.prop1 && obj.prop1.prop2 && obj.prop1.prop2.prop3 ); // => undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment