I am making a script in Javascript script that gets a SQL response, then processes it. Basically, I want to check if the username value exists in result[1]
. When it checks, it errors out and says that it does not exist. If it does not exist, I want it to return false, not stop the program.
Here is the code:
if (result[1].username != undefined) {
return true;
} else {
return false;
}
I have tried using typeof(result1) == undefined
, but it gives me the same error.