Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,610 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.