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

David Dehghani
David Dehghani
6,992 Points

If/else statement help!

Help! Treehouse is saying that my alert message is not popping up, but it is for me every time I recheck the work. Am I missing something?

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

if ( isAdmin ) {
    alert('Welcome administrator')
}

else if (isStudent === true) {
  alert('Welcome Student')
}

else {

}
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

Teja Tummalapalli
Teja Tummalapalli
5,592 Points

In the word Student , s is small letter. Try changing to students.

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Moderator Edit: Changed response from a Comment to the Answer section.

Yes, Teja is correct. You need to change "Student" to a lower-case "s" (but keep it singular). Challenges are very picky and very strict even with spelling, punctuation, and capitalization.

Keep Coding! :dizzy:

David Dehghani
David Dehghani
6,992 Points

Thank you! I feel better knowing the code is essentially right but I keep overlooking small details like capitalization.