So check the introduction of js:
1. Logical OR operator ||:
When both operands of operator || are Boolean values, it will Performs a Boolean OR operation.
It first calculates the first operand, and if the value of this expression can be converted to true, then it returns the value of the expression on the left. Otherwise, calculate the second operand
Even if the operand of the || operator is not a Boolean value, it can still be regarded as a Boolean OR operation, because no matter what type the value it returns is, it can be converted is a Boolean value.
On the other hand, || is used for non-Boolean operands, which takes advantage of its feature of returning non-Boolean values. This use of this operator usually selects the first defined and non-null value in a set of alternative values (that is, the first value that will not be converted to false)
Example :
var max=max_width || preferences.max_width || 500