Hi there,
I know that in Javascript you can do:
var oneOrTheOther = someOtherVar || "these are not the droids you are looking for...move along";
where the variable oneOrTheOther will take on the value of the first expression if it is not null, undefined, or false. In which case it gets assigned to the value of the second statement.
However, what does the variable oneOrTheOther
get assigned to when we use the logical AND operator?
var oneOrTheOther = someOtherVar && "some string";
What would happen when someOtherVar
is non-false?
What would happen when someOtherVar
is false?
Just learning javascript and I'm curious as to what would happen with assignment in conjunction with the AND operator.
Thanks!!