I don't really understand this loop, can someone please explain?


#1


/*jshint multistr:true */
var text = "fruz, chinasa, ifeoma, ijeoma, fruz, anurika, ikechukwu"
var myName = "fruz";
var hits = [];

    for(var i = 0; i < text.length; i++) {
	if (text[i] === "f") {
			for(var j = i; j < (myName.length + i); j++) {
			hits.push(text[j]);
			}
	}
   }
}


#2

@fruzzy

Please read
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.