I found the following legacy Javascript code:
function doSomething(parameter) {
if (parameter != null && parameter != undefined && parameter != '') {
...
}
}
I wonder if it is equal to check
if(parameter) {
...
}
i.e. if it is equal to check if the parameter is truthy. Is there a case when this is not equal?
undefined === trueinto a browser console0,NaNandfalse.NaN.falseand0fall inparameter != ''(see my answer)