Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Making Decisions with Conditional Statements Add an Else If Clause

I have written this code five times and it Is correct from what I see I keep getting syntax pause error

I have wrote the code for else if several times now and It looks correct but every time I get syntax pause error. I cant figure out what I am missing has to be somethin small

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>

3 Answers

Ari Misha
Ari Misha
19,274 Points

Hiya! You're almost there. You have an extra curly bracket for the first if block and typo in a variable. That's how your final output should look like:

var isAdmin = false;
var isStudent = true;

if ( isAdmin ) {
    alert('Welcome administrator');
} else if ( isStudent ) {
  alert("Welcome student");
}

I hope it helped!

~ Ari

Mike Hatch
Mike Hatch
14,940 Points
Uncaught ReferenceError: isstudent is not defined
    at <anonymous>:6:8
Mike Hatch
Mike Hatch
14,940 Points

I was able to debug two errors in your code. One is an extra curly bracket and the other is a typo in one of your variable names. You forgot to use camelCase.

Thank you so much its been along week and have brain fried moment and it really did help me out