Search Text For Your Name 7: The code got passed by my code is wrong, not sure how to fix it to display properly


Not sure how to fix it to display properly


that else statement is what's doing that. It's looking through every letter in the variable "text", and every time it doesn't find the letter the if statement it looking for then it will print "Your name wasn't found"


So now how can I get the code to work properly spelling the name now that I have fixed the if loop?


Technically there's no need, it did exactly as it was suppose to. There are ways to do it, but those are well above the skill level for this lesson, I'd say just move on :smiley:


But I want to learn.... I want to try my hand at this problem with out cheating from the other answers. haha


Well the simplest method to be to do a "toString" method, example: array.toString();

But this doesn't get rid of the commas, you'd have to redact any commas in your array like so.

string.replace( "," , "");

I haven't tested that personally, but I can't think of many ways that you could print it acurrately as you have it, this would be more useful in other languages but this lesson is more of a "proof of concept" sort of thing