I have an object named as "obj" and it has two keys named as "goal" and "item[]", ie.
var obj = {goal:"abc",item[]:"def"};
And these keys and values are created dynamically.
Problem -
I want to check if these keys exist or not. If I check
if(obj.goal != undefined){
//Do something
}
then it gives desired output. but when I do
if(obj.item[] != undefined){
//Do something
}
then it throw error(Syntax error). Please advice how to check with the second case. Thanks in advance.