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

What does || mean in javascript (Treehouse Club - MASH question)

As the question says.

3 Answers

|| Means "or".

So if you wanted to test if either condition is true, then use ||.

If any condition is true, the whole thing is true. If all conditions are false, then the whole thing is false.

Example:

var name = "Alex";

if (name == "Alex" || name == "Ren") {
    document.write("Oh hi! I know you!");
}

This program will print "Oh hi! I know you!" if name is either "Alex" or "Ren".

I hope you understand now :)

Good luck! ~alex

Tommy Gebru
Tommy Gebru
30,164 Points

Hey Alex, what has been your favorite language to work with so far? :smile:

By the way why ask? :smile:

Just curious.

P.S.: I also like Ruby time-to-time

Python and Front-end development (HTML CSS and JS)

Tommy Gebru
Tommy Gebru
30,164 Points

I wanted to just reach out to see if you are interested in becoming a moderator for treehouse, but also wanted to take the opportunity to say hello to another local developer :smile: I went to my first meetup this past week, have you ever attended workshops, or events? :thumbsup:

No I haven't.

What do you get from being a moderator exactly?

I'm just curious.

Tommy Gebru
Tommy Gebru
30,164 Points

OK :smile:

"Moderators overlook the entire forum, our main role is all round assistance but I perceive us as mentors as we're chosen not by how well we know code but by our continued dedication to help a fellow student such as yourself. I think I've learned more by being active in the forums than I have the lessons. Short of that, we help by reformatting your markdown language so images, links, or code appear correctly in the forum; or mark answers as best so that it might be helpful for someone else later who comes across that thread. Just generally helpful things."

Sure! I'll be happy to help :)

How would a proceed?

Tommy Gebru
Tommy Gebru
30,164 Points

I already recommended you :sparkles: just continue to be awesome :heart_eyes:

Recommended? Huh?

What do you mean?

He-llooooooo?????

Tommy Gebru
Tommy Gebru
30,164 Points

Hey! Alexander Davison, so a recommendation simply means that I alert treehouse staff, that you would be a good fit, this is done in similar fashion to the "Best Answer" button.

If you would like to know more about Moderators on Treehouse click me

Thanks :)

Now I understand.