Here is the code I've been working on:
function parseJSONData(jsonData){
var property, type, name, identifier, comment, content;
for(property in jsonData){
switch(property){
case "type": type = jsonData[property];
case "name" : name = jsonData[property];
case "comment" : comment = jsonData[property];
case "identifier" : identifier = jsonData[property];
case "content" : content = jsonData[property];
}
}
if(content.hasOwnProperty){
console.log(content);
parseJSONData(content);
}
The output I am getting is as follows:
[Object] footer.js:59
TypeError: 'undefined' is not an object (evaluating 'content.hasOwnProperty') footer.js:58
I find this confusing because when I log the content, it shows an object and works fine. The error only appears when I try to recursively call the function. I have not added a return statement yet due to this issue, do you think I should?