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 trialAhmed Abdellatef
11,095 PointsThe extra challenge code
When I write multiple wrong names in the prompt dialogue, it just display only the first wrong name that I entered and this only in case I write wrong names before right names in the prompt dialogue. But if I write the right names first then the wrong ones the wrong ones don't show up. here's my code. check please the last if statement I wrote and tell me what's wrong. I'm still trying for 3 days till now and get depressed. https://w.trhou.se/tnhcyycjuv
3 Answers
Steven Parker
231,275 PointsEvery call to "print" replaces the content of the "output" div. If you want to see the results of multiple calls you would need to add to the display instead of replacing it:
outputDiv.innerHTML += message; // note += instead of =
Steven Parker
231,275 PointsI'm glad I could help. Happy coding!
Ahmed Abdellatef
11,095 PointsYeahhhh! It's working now as I intended. Thank you very much.
Ahmed Abdellatef
11,095 PointsAhmed Abdellatef
11,095 PointsThanks for replying. I did like you said but the problems still the same the only change is that when I write a name isn't in the list it displays twice. And the other problems still alive: 1. when I write multiple names ( right and wrong ) in the prompt dialogue it just shows up the right names if the first name I entered exists in the list. 2. If I start the names in the prompt dialogue with a name not in the list it just shows that name and if I wrote another wrong names they don't show up. Is there any solution ? if you answered the extra challenge code can you share it with us?
Steven Parker
231,275 PointsSteven Parker
231,275 PointsOn second look, I see my previous suggestion isn't needed (or desirable) because "message" keeps growing.
But I also notice that "notHere" is not being reset for each search: