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 JavaScript Basics (Retired) Creating Reusable Code with Functions Getting Information From a Function

About İf clause statements and booleans

İ watched same video like 5 times but still i dont understand working logic. i got really confused please someone help me about it. This two value is too important for programming for sure, i have to understand it.

Benjamin Wagener
Benjamin Wagener
5,568 Points

Sorry, but I don't really get what your exact problem is. What is it specificly what you don't understand?

1 Answer

Steven Parker
Steven Parker
231,236 Points

I'm not completely clear on your issue, but I'll take a guess.

You're probably used to if statements having a comparison expression, like: if (sample == 23), or if (age > 18). The expression is evaluated and if found to be true, the following statement (or block of them) is executed.

But when you test a boolean value, it represents either true or false already, so you only have to name it, like if (over18) or if (needswater).

Was that what you were uncertain about, and did that help?