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 trialAaron Jones
637 Pointsi dont know what to do here? Need some help!
The question asked, " Add an else if clause that tests to see if the isStudent variable is true. If it is then open an alert dialog with the message 'Welcome student'?
var isAdmin = false;
var isStudent = true;
if (
<!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>
Aaron Jones
637 Pointsthat didn't work idk why its not working
Mike Shannon
7,515 PointsMake sure you're paying attention the the case-sensitivity of the alert statement it wants you to put out. I believe it has to be exactly 'Welcome student' to satisfy the challenge
Also, remember that the statement can be (isStudent === true) or simplified to (isStudent)
1 Answer
Peter Vanderlind de Oliveira
7,376 PointsHi :)
Try this instead:
var isAdmin = false; var isStudent = true;
if ( isAdmin ) { alert('Welcome administrator'); }
else if ( isStudent ) { alert("Welcome Student"); }
The following link helped me complete the challenge: https://www.w3schools.com/js/js_if_else.asp
Mike Shannon
7,515 PointsMike Shannon
7,515 PointsIt looks like your snippet is missing the first piece which is
With the previous statement in place, you'll want to follow the same structure. Try something like this.