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 trialmichelle Jia
4,814 Pointsno need to put a check for the first value collected? if it is a string, no need to put the 2nd number
conditional statement for the variables.
2 Answers
Steven Parker
231,248 PointsIf you wanted to check each input individually, you could of course skip the second input if the first one did not meet the requirements. It's a bit more work, but it would provide more immediate feedback to the user.
Good idea!
Daniel Grigo
Full Stack JavaScript Techdegree Graduate 18,815 PointsI also tried to add a condition to the first input so that if it's a string the second dialogue wouldn't appear as well as the message wouldn't be created. But I either have the problem that the second prompt is still executed but the message wouldn't appear or vice versa. I'm not sure how to get it straight. Suggestions?
Steven Parker
231,248 PointsThis isn't an answer to michelle's question. You should start a fresh question and post your snapshot link there.
Then you might want to delete this "answer".
michelle Jia
4,814 Pointsmichelle Jia
4,814 Pointsthank you for answering . the issue why i want to check validate the first input is i locally run the code totally same as the video, what i get is if i give a string to the first value, the condition in the else if statement doesn't work, no response to it, i dont know the reason.
Steven Parker
231,248 PointsSteven Parker
231,248 PointsPlease show your code here, or even better, make a snapshot of your workspace and post the link to it here.