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 trial
Yuliya Varanitsa
4,783 Pointsit does not accept answers to the first 3 questions....
3 Answers
Zack Lee
Courses Plus Student 17,662 PointsYou are using the parseInt method on all responses, which turns a string into an interger. Sonce the first 3 questions are strings which contain no numbers they are registered as undefined.
Try removing the parseInt and converting the number in your last answer to a string.
Yuliya Varanitsa
4,783 PointsYes it worked when I replaced the number to a string and deleted the parseInt. But I would like it works when there are strings and numbers at the same time.
Zack Lee
Courses Plus Student 17,662 PointsYou will never need intergers because you aren't using the values for math. Theres no more work on the users end because if they input 8, it will be understood by the system as "8" it makes no difference if its a string onstead of an interger, unless that is, if you're trying to do math with the values.
Zack Lee
Courses Plus Student 17,662 PointsThat being said, if you really need to have both intergers and strings then you need to add a conditional statement that checks for that. But again, every value will always be a string, so you would first convert the string to an interger and check if its undefined or not, then treat it respectively. To me that seems redundant and unnecessary.
Yuliya Varanitsa
4,783 PointsOh! I understood the error: integers must be enclosed in quotation marks. The question was solved. Thank you so much!
Yuliya Varanitsa
4,783 PointsYuliya Varanitsa
4,783 Pointsit does not work this way.
Zack Lee
Courses Plus Student 17,662 PointsZack Lee
Courses Plus Student 17,662 PointsCan you share your code with the revisions you made?