Help me understand this code!


Hey all,

I finished this course, and I figured out how to write the code, but I end up not understanding some parts of the second loop. Here is my code:
/*jshint multistr:true */

var text= "blah blah blather Jeff bleh bluh Jeff lol";
var myName= "Jeff"; 
var hits= [];

for(i = 0; i < text.length; i++){
    if(text[i] === "J"){
        for(var j = i; j < (myName.length + i); j++){
            hits.push(text[j]); //right above and the if statement

if(hits === 0){
    console.log("Your name wasn't found!");

It would be appreciated if you could help me out, because I've tried to figure it out, but I can't.




Have a read


Thanks for giving me the link! I experimented with the code a little, and now I can understand the loop.