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

Josias Kabore
Josias Kabore
Full Stack JavaScript Techdegree Student 2,652 Points

cant figure out what's wrong with this code

else if code

var isAdmin = false;
var isStudent = true;

if ( isAdmin ) {
    alert('Welcome administrator');
}else if(isStudent){ alert('welcome student');}
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="script.js"></script>

3 Answers

There is nothing wrong with the code you wrote, however I am pretty sure you are asking, why your challenge is failing. That would be because the alert you are outputting is not identical to what the challenge asked for. The expected result is case sensitive.

Just simply capitalize the W in your welcome student alert :]

Hello Josias Kabore,

Is there something specific that's not working with your code? I ran your code in my browser and everything worked fine. I even switched the variables around to look like this:

var isAdmin = true;
var isStudent = fasle;

And everything still worked.