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 trialJose Sanchez
7,849 PointsPlacing a boolean value that will result in true being returned. Its working fine in google chrome?
I have tried this code to in the workspace provided by google chrome and its returning true as a boolean. I am not sure what I am doing wrong here.
var correctGuess = true;
if (correctGuess === true ) {
alert('This is true');
} else {
alert('This is false');
}
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
2 Answers
Kim Still
7,355 PointsYour code is working fine for me. I get the "This is true" alert as expected.
Do you have alerts blocked somehow?
Jose Sanchez
7,849 PointsThanks, I just copied and past Amadeep's code since something weird is going on. All the other code challenges work fine but for someone reason this one does not. I understand the concept so that is what is important.
Amandeep Dindral
8,915 PointsJose,
I am glad I could help. If my answer was helpful dont forget to up vote it!
Cheers
Amandeep Dindral
8,915 PointsAmandeep Dindral
8,915 PointsHi,
The following code worked for me in the code challenge.
The conditional statement takes the value of the variable but not the variable itself. Im not sure why but you should be able to pass the challenge with the code above! Cheers