Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Andrea Boscolo
7,250 PointsIn the IF at the end why I don't need do specify correctGuess === true;?
In the IF at the end why I don't need do specify correctGuess === true;?
2 Answers

andren
28,538 PointsBecause conditional statements like if
runs based on whether the value they are given evaluates to the Boolean true
.
When you compare two values that comparison actually produces a Boolean value. true
if the comparison is correct and false
if it isn't. That means that the comparison correctGuess === true
would actually produce the boolean true
if correctGuess
stored true
and false
if it stored false
.
So comparing correctGuess
to true
would result in the exact same value that is already stored within it. Making the comparison pointless.

Andrea Boscolo
7,250 PointsThanks! your explanations are always great!