Since if(variable) ignores any falsy value, this will work for you
if(variable && variable2 && variable3)
The following values ββare always false in JS:
false. 0 (zero) "" (empty string) null. undefined. NaN (a special Number value meaning Not-a-Number!)
Update: -
If there is a case where you want to execute, if the block, even if the value is 0, you must add an additional check, specifying either 0 or another value.
if((variable || variable === 0) && (variable2 || variable2 === 0) && (variable3 || variable3 === 0))
source share