Can't figure out whats wrong with loop


#1

var text = "Ian is Ian which is Ian who is \ Ian he is Ian I am Ian.";
var myName = "Ian";
var hits = [];

for ( i=0; i {if (text[i] === "I") {for(var x = i; x {hits.push(x);
console.log(hits)
} }}

Sorry, really having trouble on this one. Any help would be appreciated. :slight_smile:


#2

@ianbarry,
Maybe if you read an analogy
https://discuss.codecademy.com/t/i-passed-this-but-i-just-need-someone-to-explain-the-second-for-loop/30895/2?u=leonhard.wettengmx.n


#3

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