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

Ryan Clark
Ryan Clark
2,000 Points

Why is this not working?

This works when i press preview. I've tried restarting the browser, signed out. Yet it still won't work. I have continued on with the rest of the course but I'm just hoping someone can have a look and se if there is anything I am missing.

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>

1 Answer

Steven Parker
Steven Parker
231,072 Points

I can confirm that this code passes the challenge if I just paste it in. Your code is correct! :+1:

If a browser restart didn't help, you might try a machine reboot. Then you may want to contact the Support folks.