I'm not sure what I'm doing wrong here

I’m working on this problem for Search Text and I don’t know quite what I’m doing wrong. I keep getting the error “Careful: your second ‘for’ loop should stop when it reaches its current point in the string + myName.length.”, can someone help me out with the answer for this line of code.

var text = "Hi my name is Anna. Anna loves to read and write";
var myName = "Anna";
var hits = [];

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

what variable holds the current point? Given j needs to stop after current point + myName.length

j should certainly be part of the comparison, given we use it to loop over your name

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