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 trialphouvaboungnaseng
1,268 PointsWhy is this code not running?
const isAdmin = true; const isStudent = false; let message;
if ( isAdmin === true ) { message = "Welcome admin"; }
const isAdmin = true;
const isStudent = false;
let message;
if ( isAdmin === true ) {
message = "Welcome admin";
}
2 Answers
Steven Parker
231,269 PointsThis should pass the challenge as it is, try again (perhaps after restarting your browser).
But for future coding, you never need to compare a Boolean to "true", you can test it just by naming it:
if (isAdmin) {
Johnathan Guzman
7,432 PointsHey phouvaboungnaseng,
That's odd - I tried it with your code and it works fine. Just as Steven suggested, refresh your browser, that might help.
const isAdmin = true;
const isStudent = false;
let message;
if(isAdmin === true) {
message = "Welcome admin"
}
Hope this helps.