The below code gives me two alerts one after the other – Hello1234 and undefined
var b ={ status:"Ready" ,
deep : { a:12 , b:"String" ,
c:function() {alert("Hello1234");
}
}
}
alert(b.deep.c());
Could anyone let me know why does that happen ?
This happens because:
b.deep.c()has a call toalertinside it.alertthe return value, so get [the string representation of undefined]undefined.