You can use the logical operator OR || which evaluates its right operand if lVal is a false value.
False values ββinclude, for example, null, false, 0, "", undefined, NaN
x = x || 1
Moritz Roessler Sep 30 '13 at 7:28 2013-09-30 07:28
source share