In javascript I need to check for a value in an if statement if it exists. The thing is 0 can be one of the accepted values. so when I do
if(!val) {
return true
}
return false
The thing is Javascript evaluates !0 = false
here are test cases what I want:
val = 0 // true
val = 91 // true
val = null // false
val = undefined = false
Basically check check for null but include 0. Not sure how to do this :/