I've just noticed that you can put boolean expressions within console.log e.g.
console.log("hey" || 2)
"hey" evaluates to
true and is printed, because the part after
|| is not evaluated in that case.
In general truthy are all values that are not
MDN defines evaluation of OR expressions as follows:
Logical OR (
expr1 || expr2: Returns
expr1if it can be converted to true; otherwise, returns
expr2. Thus, when used with Boolean values,
||returns true if either operand is true; if both are false, returns false.
So by this logic
console.log() prints first truthy expression in your statement. If you were to try
console.log(null || 2), then
2 would be printed out.