Questions on second "for" loop


#1

/*jshint multistr:true */
var text = "blak blah Jerry Jeremiah blah blad Jeremiah blah";
var myName = "Jeremiah";
var hits = [];
for (var i= 0; i < text.length; i++){
    if(text[i] === "J"){
    console.log("Entered");
    for (var j = i; j < text.length + i; i++){
    console.log("Hello");
    }
    }
}

My browser tab freezes whenever i try and enter this. I don't know if it is wrong or not.


#2

for (var j = i; j < text.length + i; i++)

Here you increment i instead of j, so j will always have the same value while i keeps getting larger. Since j will always be less than text.length + i, the loop is infinite.