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 Add an Else If Clause

Michael Jasinski
Michael Jasinski
7,427 Points

isStudent message. else if

I am having an issues with this part. I think I have the correct I have looked at others answers and it looks correct, but I guess not.

Any Ideas here?

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

if ( isAdmin ) {
    alert('Welcome administrator')
} else if (isStudent){
  alert('Welcome Student');
}
index.html
<!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>

5 Answers

pi R
pi R
12,720 Points

You have a typo on the alert message: it should be "Welcome student" and you typed: "Welcome Student" (change the S => s)

Abe : no need to add ===true, the variable is declared as true at the top;

edit: ahh.. 3 minutes late after privacypls ;)

Abe Layee
Abe Layee
8,378 Points

The question is asking to test if isStudent is true. I mean you got most of the code correct except you forgot to add the true statement.

var isAdmin = false;
var isStudent = true;

if ( isAdmin ) {
    alert('Welcome administrator')
} else if (isStudent===true;){ //is student set to true? 
  alert('Welcome Student');
}

Is the answer case sensitive? Try changing....

javascript alert('Welcome Student');

to:

javascript alert('Welcome student');

Mat Morris
Mat Morris
10,292 Points

The answer is case sensitive. If you type 'Welcome Student' it WILL NOT work. I did that.

Michael Jasinski
Michael Jasinski
7,427 Points

Thank you all for the help on this! Sometimes you just have to rework the wording.