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

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,323 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