I currently have an object called "obj" with two keys: "goal" and "item[]". It looks like this:
var obj = {goal:"abc",item[]:"def"};
These keys and values are dynamically generated.
Now here's the problem -
I need to determine if these keys exist in the object. If I use the code
if(obj.goal != undefined){
//Do something
}
it works as expected. However, if I try
if(obj.item[] != undefined){
//Do something
}
I encounter a syntax error. Can someone please advise on how to check for the second case? Thank you in advance.