I have an object with other objects inside of it that I need to access. How do I do it?
var obj = {a: {b: 1}} //I need to have access to b.
Right the for in loop just returns "a". The problem is I'm not trying to get a string inside an object, I'm getting an object inside an object.
var obj = {
a: {r: "why cant i access"},
}
for(var o in obj){
document.getElementById("div").innerHTML = o.r;
}
<div id="div"></div>