My variable a in some scenarios have branch b and in some other - has not. How can I check if a.b.c is defined?
// scenario 1
var a = {
  b: {
    c: "d"
  }
}
// scenario 2
var a = {}
I tried using typeof but without success:
if (typeof a.b.c != 'undefined') {
  console.log('y', a.b.c)
} else {
  console.log('x', a.b.c)
}
 
     
    