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 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
229,732 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
229,732 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
229,732 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".