Logical OR Operator (||)

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

In JavaScript, you can combine multiple conditions together, using the logical OR operator (||), to create a complex condition. The logical OR operator's symbol is two pipe characters in a row. In order for this complex condition to evaluate to true, one of the conditions inside it must be true.

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

if ((customer == 'senior') || (customer == 'veteran') || (customer == 'Chuck Norris')) {
alert('You get 50% off!');