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 trialUnsubscribed User
4,164 PointsI 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
var isAdmin = false;
var isStudent = true;
if ( isAdmin ) {
alert('Welcome administrator');
}
} else if ( isstudent ) {
alert("Welcome student");
}
<!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
19,323 PointsHiya! 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
14,940 PointsI 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.
Unsubscribed User
4,164 PointsThank you so much its been along week and have brain fried moment and it really did help me out
Mike Hatch
14,940 PointsMike Hatch
14,940 Points