JavaScript boolean false

If a number is used where a boolean value is expected, the number is converted to TRue unless the
number is 0 or NaN , which are converted to false . If a string is used where a boolean value is expected,
it is converted to true except for the empty string, which is converted to false . null and the undefined
value convert to false , and any non-null object, array, or function converts to true .

你可能感兴趣的:(JavaScript)