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 trialYuval Gat
7,875 PointsHi, the || binary operator means "Or". If either one of the operands evaluates to true, the condition becomes true. For example:
if(5 < 7 || 6 > 8) {
alert("Hello!");
}
"Hello!" will be alerted, because one of the conditions (5 is smaller than 7) evaluates to true.
true || false // Which evaluates to true.
2 Answers
Jennifer Nordell
Treehouse TeacherIt means "or". If (x == true || y == true) for example. If either one of those are true the entire condition will evaluate to true.
jason chan
31,009 Pointsmeans or
Dan Weru
47,649 PointsDan Weru
47,649 PointsHi Rewien It is OR operator. for instance,
valueOne || valueTwo
meaning valueOne or valueTwo