there are instanced where i expect the file_extens...
# suitescript
m
there are instanced where i expect the file_extension to be "undefined" - but my condition doesn't appear to work. also tried typeof(file_extension) === "undefined"
b
what are you trying to do?
Copy code
file_extension !== null
should render
Copy code
typeof file_extension === "undefined"
unnecessary. undefined is not equal to null
👍 1
e
Also,
undefined
is not a string, it's a primitive value
If you expect
file_extension
to not be there some times, then
if (file_extension)
should be sufficient
👍 1
null
,
undefined
,
""
,
0
,
false
,
NaN
will all evaluate to
false
in a Boolean context: https://developer.mozilla.org/en-US/docs/Glossary/Falsy
sorry I missed your `typeof`s, but this ^ still applies
I've rarely found the need to check explicitly for
undefined
and not the other empty values
m
It was meant to be typeof file_extension !== "undefined" - anyway, if(file_extension) worked, I thought it was not working previously hence why I was aiming to check for undefined. All good, thanks