Need some clarification / understanding on 1.5 Your second for loop


#1



I'm not stuck per- say as confused. After I run the code below I get "12" on the console and it says I pass. I've done the 1.5 "Your second for loop" exercise but I don't understand it fully. Any comments are appreciated to help me understand it clearer on what the 1.5 "Your second for loop" exercise was looking for and how I achieved it.


var text = "Joel is an awesome guy, Joel is a lucky guy,\
Joel is wonderful and gosh darnit people like him!";

var myName = "Joel";

var hits = []

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


#2

Take a look at this thread https://discuss.codecademy.com/t/second-for-loop-i-am-so-confused/12176/9?u=rydan and you can perhaps get an idea what's going on