5. Your second 'for' loop - can't find the problem


#1

var text = "Hey, how are you \
doing? My name is Egg. I've always \
been a cool Egg.";
var myName = "Egg";
var hits = [];

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


#2

In what way would you like it to behave differently? What are we looking for?


#3

Hi this part remove the ; after the if condition

if(text[i]==='E'); <== this one

and the here

for(j = i; i + myname.length; j++)

this part i + myname.length you forgot j < to put before it like that

j < i + myname.length

So it should be

for(j = i; j < i + myname.length; j++)

#4

for (var i = 5; i <= 50; i+=5) {
console.log(i);
}


#5

HI why do you post a code that doesn't have to do with the discussion and on a discussion of 1 mounth ago?