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.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
SO... Any idea how should I compare the variable with, so it will detect the undefined?