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 Making Decisions in Your Code with Conditional Statements Write an 'if' Statement

Maurice Ansley
Maurice Ansley
994 Points

still not helping. I need the answer please for this one. I am unable to figure it out for a week now. I will understand

Unable to figure out Challenge Task 1 of 1 for a week now. Hints are not doing it for me. It is a simple mistake I know.

script.js
const isAdmin = 'true';
const isStudent = 'false';


if ((let message = isAdmin) === true ) { 
   console.log("Welcome Admin")
}

2 Answers

Rohald van Merode
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Rohald van Merode
Treehouse Staff

Hi Maurice Ansley 👋

It looks like you've changed the values of both the isAdmin and isStudent variables to be strings rather than the provided boolean values. You'll want to revert that change and bring back the declaration for the message variable. After this change, the first three lines should look like this:

const isAdmin = true;
const isStudent = false;
let message;

As for the conditional, you'll want to have a look at the challenge:

Create a conditional statement that tests if the isAdmin variable is true. If it's true, set the value of the message variable to "Welcome admin".

Currently, you're logging "Welcome admin" to the console rather than setting the value of the message variable to "Welcome admin". You'll instead want to do something like this:

if(isAdmin === true) {
  message = "Welcome admin"
}

I hope this clears things up and helps you to get going again 😄

Maurice Ansley
Maurice Ansley
994 Points

const isAdmin = false; const isStudent = false; let message;

if ( isAdmin ) { message = 'Welcome admin'; } else if ( isStudent ) { message = 'Welcome student'; } else { message = "Access Denied" } Thank you so much... I was going crazy.. lol