. Your second "for" loop


i dont want it easy, but make it clear.. im crashing the web over and over.... ?? why J?? Remember some folks here are new to JavaScript. can someone explain that well?? the instruction are weird . sorry but it is true.


Hi @cubanocode,

I'm positive you are writing an infinite loop. Please copy and paste your code and we will give you hints on how to fix it.


Could you please provide us with your code and a link to this exercise? It'd be easier to help.

But essentially, you're stuck in what we call an "infinite loop".

An infinite loop (sometimes called an endless loop ) is a piece of coding that lacks a functional exit so that it repeats indefinitely.

You'll need to exit it by specifying a clear condition.


i deleted the code... i cant passed this
for(var j = i; next ? ? ?? i dont get it at all ... should go j < myName.length) j++); { ??


var text = "Reinier Reinier Reinier";
var myName ="Reinier";
var hits =[];

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


thats my code


The point of this for loop is to cycle through numbers one at a time until it reaches the length of the variable text.

Remembering this when you create an if statement inside a for loop you need to incorporate your for loop variable (i) inside your if statement. As i is cycling through numbers it needs to be inside the square brackets after text.

Lastly the j should be outside the brackets here.

Not sure If I explained that very well.
Let me know if that helped and solved it or if you need further explanation.


thank you for you help.. i got it right, but i still dont get it
i came up with this and it works
j <i + myName.length ; j++)

j< i ?? why


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