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 trialColin Jones
1,174 Pointshttps://w.trhou.se/v3xnv3nzzk trying to figure out why I am getting 4 & 5 questions answer guessed correctly every time
Incorrect number of questions guessed correctly. Always gives me either 4 or 5 correct questions even when trying to guess the questions incorrectly.
1 Answer
Steven Parker
231,275 PointsIt looks like Lionel has you covered, but I wanted to point out that as an alternative to converting your answer to a number with "parseInt" so you can compare it with the number 4, you could simply compare the answer with the string "4".
lionel cardenas
9,659 PointsVery true Steven. Thats what I did on mine.
Colin Jones
1,174 PointsThank you both for your help! I really appreciate the prompt replies!
lionel cardenas
9,659 Pointslionel cardenas
9,659 PointsHi, Thanks for posting. From what I can see is that in the condition your putting (Q1 = 4 || four) what it should be is (parseInt(Q1) === 4 || Q1 === "four"). When you use just a single = it means your defining something, plus need the parseInt so it converts the input into a number. Seen the same on your other if statement questions . I copied and changed your code and it works for me. I hope that helps. Plus the last section needs to be corrected. Its not giving the correct crown. But that easy as changing some numbers (hint hint). I hope that helps without fully doing it for you.