Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics Making Decisions in Your Code with Conditional Statements Write an 'if' Statement

Joshua Hughes
Joshua Hughes
1,865 Points

Create a conditional statement that tests if the isAdmin variable is true.

I'm not sure what I'm doing wrong

script.js
var isAdmin = false;
var isStudent = false;

if ( isAdmin === true) {
  console.log("Hello Admin.");
} else if ( isAdmin === false) {
  console.log("Are you a student?");
}

2 Answers

Steven Parker
Steven Parker
210,474 Points

It looks like you may have confused this challenge with a later one. You won't need "else" in this one.

But the instructions say to test the variable and then assign "message" with a particular value. But the declaration of "message" originally provided seems to be missing here. And string to be assigned is different from the one shown here. And you won't need to log anything.

Joshua Hughes
Joshua Hughes
1,865 Points

I did get it messed up and I figured it out. Thanks!