Your Second "For" Loop - stuck in an infinite loop


I cant run the code because its in an infinite loop byt i do not know how to fix the infinite loop. any solutions?

/*jshint multistr:true */

var text = "Hello, My Name Is Jake. / Nice To Meet You.";
var myName = "Jake";
var hits = [];

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

Replace this line with your code.


Hi Jake,

I'm also working on this activity. Why did you write (var j = i; j < i+myName.length; i++) { ?

Shouldn't it be the following:
for (var j = i; j < i+myName.length; j++) {


Ohhhhhhhhhhh, Thanks. I Was Confused There. Thanks for pointing that ouy


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