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) Making Decisions with Conditional Statements Booleans

carl simpson
PLUS
carl simpson
Courses Plus Student 15,941 Points

adding booleans

Hi what gives with this question.. i have tried a few varieties but nothing seems to pass..

var condition = false;
if( 2 > 1) {
  condition = true;
}
if ( condition === true ) {
    alert('This is true');
} else {
    alert('This is false');
}

2 Answers

Alex Heil
Alex Heil
53,547 Points

hey carl, I just re-did this challenge to checkout your prob and your code is probably way too advanced for it ;)

in fact all the code is already there in the if-else conditional and you only have to insert one word, the boolean value (true or false), into the if-statement.

at the end the full solution should look like this:

if (true ) {
    alert('This is true');
} else {
    alert('This is false');
}

hope that helps and have a nice day ;)

carl simpson
PLUS
carl simpson
Courses Plus Student 15,941 Points

ah .. thanks for that alex , i had set it originally as if(true === true){};

over complicating things in my head as usual ;)