(obj["h"] !== undefined) not working?

if (obj[“h”] !== undefined){ //crashes here if “h” is not found. how to resolve? it doesnt seem to work for boolean detection of “undefined”

iValue =
{“u":“demouser”,“e”:"[email protected]”,“h”:“12345”} //ok

BUT {“u":“demouser”,“e”:"[email protected]”} //ok

obj = JSON.parse(iValue)

if (obj[“h”] !== undefined){ //crashes here if “h” is not found. how to resolve?

}

I am afraid that really is rather a question for StackOverflow.

1 Like

can anyone help with this? i’m surprised it does not work on cloudflare after seeing the solution on stackoverflow.

if (obj[“h”] !== undefined){ //crashes here if “h” is not found. how to resolve? it doesnt seem to work for boolean detection of “undefined”

iValue =
{“u":“demouser”,“e”:"[email protected]”,“h”:“12345”} //ok

BUT {“u":“demouser”,“e”:"[email protected]”} //ok

obj = JSON.parse(iValue)

if (obj[“h”] !== undefined){ //crashes here if “h” is not found. how to resolve?

}

No, it is not a Cloudflare problem. You need to clarify this with a JavaScript developer. And please do not open more than one thread about the same topic.

1 Like