JS Your second "for" loop (Search Text For Your Name)


Please help!

/*jshint multistr:true */

var text = "Hannah, this is serious stuff. My name is Hannah too! \
what's up, Hannah?";

var myName = "Hannah";

var hits = [];

for( var i = 0; i >= text.length; i++) {
if (text[i] === "H") {
for(var j = i; j >= (text.length + i); j++) {

what's incorrect?


the condition here should rather

j < (text.length + i)


Thank you, I just changed the error. I forgot to inform you on what the computer is saying: Careful: your second 'for' loop should stop when it reaches its current point in the string + myName.length.


This line should also be

 i < text.length

missed that


/*      the second for loop begins when the current character
        matches the first letter in myName. the loop will
        start at the index where you got the match(i.e.'i') and will
        only run for the length of myName.
        Now we write this statement j<myName.length+i adding the
        'i' to ensure that we always begin the second for loop at the 
        index where we found the match