Question: What's the difference between `|` and `||` in Javascript?

Furthermore, what's the difference between `&` and `&&`?

Answer: 
Another difference is that `||` uses shortcut evaluation. That is, it only evaluates the right side if the left side is `false` (or gets converted to false in a boolean context, e.g. `0`, `""`, `null`, etc.). Similarly, `&&` only evaluates the right side if the left side is `true` (or non-zero, non-empty string, an object, etc.). `|` and `&` always evaluate both sides because the result depends on the exact bits in each value.

The reasoning is that for `||`, if either side is true, the whole expression is true, so there's no need to evaluate any further. `&&` is the same but reversed.

The exact logic for `||` is that if the left hand side is "truthy", return that value (note that it is **not converted to a boolean**), otherwise, evaluate and return the right hand side. For `&&`, if the left hand side is "falsey", return it, otherwise evaluate and return the right hand side.

Here are some examples:

```
false && console.log("Nothing happens here");
true || console.log("Or here");
false || console.log("This DOES get logged");
"foo" && console.log("So does this");

if (obj && obj.property) // make sure obj is not null before accessing a property

```
In Javascript perspective, there is more to it.

```
var a = 42;
var b = "abc";
var c = null;

a || b;     // 42
a && b;     // "abc"

c || b;     // "abc"
c && b;     // null

```

Both || and && operators perform a boolean test on the first operand (a or c). If the operand is not already boolean (as it's not, here), a normal ToBoolean coercion occurs, so that the test can be performed.

For the || operator, if the test is true, the || expression results in the value of the first operand (a or c). If the test is false, the || expression results in the value of the second operand (b).

Inversely, for the && operator, if the test is true, the && expression results in the value of the second operand (b). If the test is false, the && expression results in the value of the first operand (a or c).

The result of a || or && expression is always the underlying value of one of the operands, not the (possibly coerced) result of the test. In c && b, c is null, and thus falsy. But the && expression itself results in null (the value in c), not in the coerced false used in the test.