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 trialDaquan Fudge
1,879 PointsI'm confused on how to increment initialScore once if I'm suppose to declare totalScore as a constant.
I thought that I can simply add ++ to the assigned value of initialScore. The challenge keep saying increment the value of initialScore once. I;m not sure what I'm doing wrong.
// Enter your code below
var initialScore = 8
let totalScore = ++initialScore
initialScore = ++initialScore
let isWinner = 10 != 10
2 Answers
MUZ141095 Kelvin Chawora
9,348 PointsOkay. You almost got it. The challenge is asking that you create a constant called isWinner, then assign the results of a comparison operation. It seems like in your code, you are assigning the incremented value of initialScore to totalScore (let totalScore = ++initialScore), then re-increment the value of initialScore again. That's where the error is coming from.
I believe you need something like this to solve your problem:
var initialScore = 8
let totalScore = ++initialScore
let isWinner = totalScore != 10
Daquan Fudge
1,879 Points@MUZ141095 Thanks dude.