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

JavaScript

it does not accept answers to the first 3 questions....

3 Answers

You 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.

it does not work this way.

Can you share your code with the revisions you made?

Yes 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.

You 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.

That 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.

Oh! I understood the error: integers must be enclosed in quotation marks. The question was solved. Thank you so much!