&& There are three ways to understand JavaScript:
1. When the two operands are Boolean,,&& performs a Boolean and (and) operation on two and returns true only if two are true. If one of them is false, it returns false.
X==0&&y==0//Returns True only if X and Y are both 0
2.&& can perform Boolean and (and) operations on truth and false values. If the two operands are true, then a true value is returned, or at least one of the operands is a false value. (False values are: false, null, undefined, 0, -0, Nan, and "", all other values include all objects being true).
3.&& first calculates the operand on the left. If the result is a false value, the whole is a false value, then the value of the left operand is returned.
Left is true: computes the value of the operand to the right and returns it as the result of the entire expression:
var m={x:1};
var p=null;
O&&o.x//1:o is true, so the return value is o.x
P&&p.x//null:p is a false value, so return it without calculating the p.x
This behavior of && is sometimes called a "short circuit".
&& in JavaScript