Handling Undefined

Hello, it's me again, with my dynamic data.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
My question is:
How should I compare a variable which returns undefined?
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

The case:
Currently I am handling my error message.
My data result has dynamic result, depends on the error:

EX:
{
"errors": {
"invitedTeamIds": [
"The value 'asdf' is not valid."
],
"restrictedTeamIds": [
"The value 'test' is not valid."
]
}
}

So the invitedTeamIds here is not always appear.
It can become something like:

{
"errors": {
"restrictedTeamIds": [
"The value 'test' is not valid."
]
}
}

if the input for the invitedTeamIds is correct, the object won't error.
Now, the problem is, since I need to check if the object first (if it is exist or not), I made something like

if ({{Resource.data.data.errors.invitedTeamIds }} != {{null}} ||
{{Resource.data.data.errors.invitedTeamIds }} != '')
{
result.push({{Resource.data.data.errors.invitedTeamIds}});
}

but the validation (which compares to null and string empty) returned true (because it returns undefined).
Which will put "undefined" text to my result array.
image

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
SO... Any idea how should I compare the variable with, so it will detect the undefined?

You should be able to detect undefined, it's a global eg

if({{Resource.data.data.errors.invitedTeamIds}} !== undefined) {

Not sure if that answers your question as I'm not clear what output you're expecting - the error object seems to only show errors, not empty error arrays, so your results array and error array are going to be the same?

Yup, it works.
Thank you.

btw... I also found I can convert it to string
so it is something like
if(String({{Resource.data.data.errors.invitedTeamIds}}) != 'undefined') {