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 trialpavandeepsoor
13,053 PointsDoes the answer here involve 'if statements'?
I am not sure whether I am supposed to use an 'if' statement to answer this challenge, since in the course it has not been taught yet. Was there a more simpler answer?
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! Yes, there is a simple answer here and it does not involve an if
statement. I believe the line you are most likely stuck on is this one:
let isWinner = initialScore != 10
This sets up a constant named isWinner
per the challenge instructions. Then it looks at initialScore and compares it to 10. The result of this comparison will be assigned back into the isWinner
constant. So if the score is 10, false will be assigned to isWinner. Otherwise, true will be assigned. Hope this helps!
pavandeepsoor
13,053 PointsGreat - many thanks!