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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![niels Lostaunau](https://uploads.teamtreehouse.com/production/profile-photos/9637292/micro_904409_10151639725829276_1780701513_o.jpg)
niels Lostaunau
638 Pointsplease I don't want the actual answer, just an outline of how to tackle this!
I'm not sure how to start, should I first create a prompt string, then a conditional statement
var isAdmin = true;
var isStudent = false;
if (true) {
alert(welcome administrator)
}
else {
}
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsYour conditional structure is good, except you won't need an "else" clause for this particular challenge. But instead of "true" you need to substitute the name of the boolean value you want to test. You'll only need a name because boolean values don't need to be compared to anything.
Then in your "alert" call, be sure to put quotes around the sting you want to display.
I'll bet you'll get it now.
eslam said
Courses Plus Student 6,734 Pointseslam said
Courses Plus Student 6,734 PointsYour code is fine the mistake you made is the message inside alert, when you write a string you need to put it insde a single or double code like that :
alert("Welcome administrator")
Just in case you're struggling with conditional statements : lets say we have a variable with a name
var name = "niels";
i am checking if name === ( equal to ) the value of the string
// do something
else
// do something else
lets take another example:
lets say i want to capture users age and if age is less than 18 then alert that he cannot browser the website if hes above 18 alert welcome feel free to use our website
1- Creating a variable to hold the user input on it
var age = prompt('How old are you ?');
2- creating if & else statements to check if user age it less than or greater than 18
if anything still unclear ask for it