Please help


#1


I'm stuck on the second for loop in "search text for your name", can't quite work out what's causing the problem.

When I try to run it, it comes back with "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."

I've included the code below, can anybody help?


var text = "b;ouifui;rhfjhhlancdiyTomfsnpicvsuirvdr'm,dkbsvlTom\
sdnkiujgleuijknfvopswjkbmnuio;dTom.";
var myName = "Tom"
var hits = [];
for(i = 0; i < text.length; i++) {}
if(text[i] === myName[0]){
    for(j = i; j < (myName.length + i); j++){;
     hits.push(text[j]);
    }
    };
   
console.log(hits)


#2

That bracket is sealing off your 1st loop from the 2nd. You'll still need it later on in your code.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.