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 Add an 'else if' Clause

What is wrong with this code?

I do not understand how to change else if message

script.js
const isAdmin = false;
const isStudent = true;
let message;

if ( isAdmin ) {
  message = 'Welcome admin';
} else if ( isStudent ) {
   message = "Welcome student";        
  }else () {

 }

Hey it seems you completed the code for the challenge just fine, however, i believe the additional 'else' clause that you added may be unnecessary and that may be whats stopping you from going forward here. Try removing that empty else statement and I believe it will work

I figured it out. I removed () from the last else and it ran. I was able to complete the whole challenge. Thanks for the help!

1 Answer

Steven Parker
Steven Parker
231,275 Points

You actually have the right code, but then after it there's more code that is not asked for in the instructions. The final "else" and what follows it should not be there.