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 trialdonteburns
3,265 PointsStage 4: Making Decisions with Conditional Statements Challenge
Can someone tell me why my code isn't working?
var isAdmin = true; var isStudent = false if ( isAdmin === true ) { document.write('<p>Welcome administrator</p>'); } else { document.write('<p>You are not the administrator</p>'); }
When I check my answer it tells me that I am wrong and asks if I have added the word 'true' inside of the () of the if clause. I have but I still get it wrong. Thanks for the help.
Donte'
3 Answers
Sam Baines
4,315 PointsHi Donte - the reason the code isnt working is because you are using the document.write command instead of the alert() command I believe - so as follows:
if (isAdmin === true) {
alert('Welcome Administrator');
} else {
alert('You are not the Administrator');
}
Hope this helps. Always read the challenge again if you get a bummer come back.
Jonathan Cousins
4,160 PointsIt's asking for an alert if isAdmin
is true.
var isAdmin = true;
var isStudent = false;
if(isAdmin === true) {
alert('Welcome administrator');
}
donteburns
3,265 PointsThanks, somehow I kept overlooking that.