Second for Loop


#1

I keep getting errors for this code, I checked a million times but can't seem to find it. Can anyone help?

var text = "Rick, Cole, Name, Name2, Name3, Name4, Name5";
var myName = "Caleb";
var hits = [];

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


#2

for (var j = i; j = i + myName.length; j++){
when you type that, the code keeps running because it is an infinite loop. When you type j = i + myName.length, there isn't a < , >, <=, or >= sign anywhere in that line, so it keeps running on and on and on.


#3

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