JavaScript Treehouse Club - MASH MASH - JavaScript Important Stuff - Part 3

2 Answers

the || means OR. It's a logical operator to check if the conditions on either side of the || is true or false.

James Matthews
James Matthews
21,579 Points

Hi dude!

|| in JavaScript is the logical OR operator. Logical operators are used to combine multiple tests into a single condition, such as:

if (99 < score || score < 99) {
        document.write('<p>Who cares what ur score is! Nice job!</p>');
}

In this condition, the result will return true if score is greater than 99, OR if score is less than 99.