I have a javascript function with an if else statement to return a value if the input parameter is blank. It doesn’t appear to be returning anything, unless there is something wrong with my javascript.
When I set the test variable to empty, it doesn’t return false just an empty string. I wrapped this function in a conditional so i get the output i want in case of a null value but it should run even with a null parameter input
in your screenshot the test array is not empty, has one element of value 0
and the result seems correct.
have you tried with an empty array []
as input?
I did. Rather not an empty array but just nothing. Then it outputs nothing even though the if statement should check for an empty vairable and return a flag.
can’t say for sure without seeing the code, but I think it’s not returning anything because it throws an error when accessing recordIds.length
because null doesnt have length. Check your logs for confirmation. If that’s the case you need to check that the input variable it’s not empty before moving on
That makes sense, it not an empty array its just an empty variable, ie undefined. Thanks!
1 Like