このコードは、オブジェクトを読み取るためにどのように読み取り、その中のオブジェクトを読み取ることができますか?
var book = {
"main title": "Javascript",
"sub-title": "Def Guide",
"for": "all audiences",
author: {
firstname: "David",
surname: "Fatagans"
}
};
for (propName in book){
console.log("key: " + propName + " value: " + book[propName]);
if (typeof book[propName] === "object"){
for (innerObject in book[propName]){
console.log("key: " + innerObject + "value: " + book[propName][innerObject])
}
}
}