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 trialLana Wong
3,968 PointsPreview Does not Work
My code does not seem to work when I press PREVIEW, but when I press CHECK WORK, it says the code is correct. So there is nothing wrong with my code. Why is the PREVIEW button not work?
var initialScore = 8
let totalScore = ++initialScore
let isWinner = totalScore != 10
1 Answer
Derek Scollon
8,422 PointsThe preview works but usually just shows errors so the output is usually blank if your code compiles correctly. Just to try it out, try entering this...
var initialScore = 8
let totalScore = ++initialScore
let isWinner = totalScore != 10
let isWinner = false
...and look at the preview. Since this code is trying to declare the isWinner constant twice, this is an error and the preview will show you this.