Using && to set a Logical Value
While the double pipe || (logical OR) is useful to set a default value, a double && will set an alternate value. Below is a comparison of the difference:
name is now set to ‘Brian’ as the value was null, so the || set ‘Brian’ as the default instead.
In the second example, the alternate will be picked, if the condition is true. name is ‘Brian’ so we swap that value out for ‘Jim’.
In the above, the name value would be false.