I've heard about something called operator evaluation. Now I'm asking you to tell me if I'm right:
So take a look at the following code
var a = 5;
false && (a = 2);
console.log(a);
the result in this code will remain 5
that's because the &&
operator will look first at the first operand and after that it will look at the second operand. and because the first operand is false we wont get to the second operand so it wont get executed.
This thing called an operator evaluation and this operator evaluation applied to any operator. it first look at the first operand(first meaning the one on the left side) and after that the second(right side)
Am I right ?