5/7. Please help!


#1

What I did wrong?

var text = " Hey how are you \ doing?";
var myName = "Estefania";
var hits = [];
for ( var i = 0; i< text.length; i += 1); {
if (text[i] === 'E'); {
for ( var j = i; j < (myName.length + i) j++) {
hits.push(text[j]);
}
}
}


#2

Semicolon after for or if simply terminates these constructions.

Take a look at my comments to your code:

var text = " Hey how are you \ doing?";
var myName = "Estefania";
var hits = [];
for (var i = 0; i < text.length; i += 1); {		   // unwanted semicolon
    if (text[i] === 'E'); {			           // unwanted semicolon
        for (var j = i; j < (myName.length + i) j++) {	   // one missing semicolon, try to figure this out :)
            hits.push(text[j]);
        }
    }
}

And it might be a good idea to change text to string containing your name :panda_face:


#3

Still syntaxerror :frowning:


#5

Thank you :smile: its works. I didnĀ“t read the last part of your message


#7

Great! You're very welcome :smile:


#8

I read almost every post on 5/7. FINALLY, I read yours! Thank you! :smiley:

I feel like I am only vaguely understanding this "second for loop" challenge. I was doing great until this one...:frowning:


#9

Awesome! You're very welcome :panda_face:

Well, this might be a good sign! The code in this section is a bit.... illogical. What is the reason of writing a script to search for a name where we don't get any significant output and our program thinks that Mark and Mike are exactly the same names? I don't know.

Maybe algorithmic and logical part of your brain does not work well with sloppy solutions like this one :smile:

My advice - finish this section and move on. I honestly think that this is the worst part of this course.