5. Your second "for" loop **PLEASE HELP!**


5- Your second "for" loop

PLEASE HEEEELP. I've been stuck for hours and I can't seem to understand my mistake!

I tried everything. It keeps writing:
Oops, try again. It looks like your second 'for' loop isn't pushing values to the hits array. Make sure it's working properly and that myName's text appears somewhere in the text variable.

Please haaalp :cry:

/*jshint multistr:true */
var text = "Eve Eve Eve Eve Eve";
var myName = "Eve";
var hits = [];
for (var i=0; i<text.length; i++); {
    if (text[i]==="e") {
        for (var j=i; j<myName.length + i; j++) {


Hi this line remove the ; at the end

for (var i=0; i<text.length; i++); <--

then in the if statement

if (text[i]==="e")

the if statement should check for the first letter of your name , remember that you wrote "Eve"


THANK YOU!!! It's just like you just saved my life!!! :smiley:


Também você pode fazer assim:
/ * jshint MULTISTR: true * /
var text = "Eve Eve Eve Eve Eve" ;
var myName = "Eva" ;
var sucessos = [];
for(var i = 0; i < text.length; i += 1) {
if(text [i] == "Eva");
for (var j = i; j < (myName.length + i ); j += 1) {
hits.push (text [j]);