Check If Two or More Variables Are All Equal to Zero in JavaScript What is the shortest way to check if two or more variables are equal to 0 in JavaScript? 

I'm curious to know if there's something shorter than if(!x&amp;&amp;!y&amp;&amp;!z){...}.
(EDIT: This first part refers to the original phrasing of the question.) 

First, (!x&amp;&amp;!y&amp;&amp;!z) returns a boolean, which makes ?true:false entirely redundant. It's basically like using

if (x == true)
  return true;
else if (x == false)
  return false;


instead of return x;.

That gives you

!x&amp;&amp;!y&amp;&amp;!z


(EDIT: The remainder still applies to the new version of the question.)

Now you could apply De Morgan's law. The above is equivalent to

!(x||y||z)


Which is the same length for 3 variables and longer for 2 variables. But for each variable beyond the third, you save one more character!

Lastly, if you know that your variables are numbers, you can also use the bitwise operator, i.e.

!(x|y|z)


If you actually need booleans (which I assume from your snippet), this doesn't work for the &amp; case, because !x&amp;!y&amp;!z will give you an integer. Then again, in JavaScript it's often enough to have truthy or falsy values, in which case, that's a perfectly valid option.

Bonus tip: if you ever want to turn a truthy/falsy value (like a non-zero/zero number) into a boolean, don't use x?true:false either, but use !!x instead. !x is a boolean with the opposite truthiness/falsiness than x, so !!x is true for x truthy  and false for x falsy.