Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript The Solution

no 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
Steven Parker
216,148 Points

If 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! :+1:

thank 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
Steven Parker
216,148 Points

Please show your code here, or even better, make a snapshot of your workspace and post the link to it here.

Daniel Grigo
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Daniel Grigo
Full Stack JavaScript Techdegree Graduate 18,815 Points

I 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?

https://w.trhou.se/n9wbz6w0gu

Steven Parker
Steven Parker
216,148 Points

This 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".