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

josephpatrickpotot
josephpatrickpotot
18,010 Points

I don't know why I keep getting error message for this task when I check the work it seems to work fine.

the task is to add an else if condition if variable isStudent is true and send an alert message saying "welcome student". Weird thing is that when I press the recheck work it would pop "Welcome Student" message however the system couldn't seem to identify properly the code and keeps giving me the "Bummer!" red x message whenever I press to recheck work. Anyone can assist me on this?

script.js
var isAdmin = false;
var isStudent = true;

if (isAdmin === true) {

  alert('Welcome administrator');

} else if (isStudent === true) {

  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

Stephan Olsen
Stephan Olsen
6,650 Points

You're actually doing it right, the message you're alerting is just not excactly the message that was asked to be alerted. You're writing Students with an uppercase 'S'. Changing it to lowercase will let you advance.

Stuart Wright
Stuart Wright
41,119 Points

The challenge is just being very picky. Your code is correct, but 'Welcome student' needs to have a lowercase s on student. You've done an uppercase S.

josephpatrickpotot
josephpatrickpotot
18,010 Points

Seriously???!!! Oh well, we know the joke about eggs and milk for programmers... Thanks dude!