Logical AND Operator (&&)

By: Dusty Arlia
Published on October 30, 2012
Last Updated on Sunday, July 12, 2015 at 2:12 PM
Total Updates: 5

In JavaScript, you can combine multiple conditions together, using the logical AND operator (&&), to create a complex condition. The logical AND operator's symbol is two ampersands in a row. In order for complex conditions to evaluate to true, all the conditions inside it must be true.

Here is an example of a complex condition that uses the logical AND operator:

if ((price > 5) && (weight < 20)) {
alert('Shipping is free!');
}

Comments:

Ad:

Ad: