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

Justin Wheeler
Justin Wheeler
4,921 Points

Boolean Value Exercise

I have tried several different ways of solving this problem. It is making me think the directions are not clear or something else is a factor. Or maybe it is something obvious that I have missed.

I declared a variable and set it to true and then placed that in equal to true in the conditional statement.

script.js
var booTest = true;

if ( booTest === true) {
    alert('This is true');
} else {
    alert('This is false');
}
index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

1 Answer

Adam Beer
Adam Beer
11,314 Points

This is a good solution but not now. Just put true boolean value inside the if() statement and don't create a new variable.