Expand Minimize
1 out of 3 rated this helpful - Rate this topic

Logical AND Operator (&&) (JavaScript)

JavaScript - Internet Explorer 10

Performs a logical conjunction on two expressions.

result = expression1 && expression2 
result

Any variable.

expression1

Any expression.

expression2

Any expression.

If both expressions evaluate to true, result is true. If either expression evaluates to false, result is false.

JavaScript uses the following rules for converting non-Boolean values to Boolean values:

  • All objects are considered to be true.

  • Strings are considered to be false if they are empty.

  • null and undefined are considered to be false.

  • A Number is false if it is zero.

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards. Also supported in Windows Store apps. See Version Information.

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.