I'm stuck at 5/7, help?


#1

var text = "Klljoy & Clique";
var myName = "KIlljoy";
var hits = [];
for (k = 0; k < text.length; k++)
{
if(text[K] === myName[0]
{
for (j = k; j < (myName.lenght + 1); j++)
{
hits.push(text[j]);
}
}
}


#2

Hi here myName.lenght + 1); you put + 1 instead of + k
And you should close your if condition ()


#3

okay uh i changed the + 1 and closed the if condition by it still won't work


#4

here's my code so far

var text = "Killjoy & Clique";
var myName = "KIlljoy";
var hits = [];
for (var i = 0; i > text.length; i = i++)
{
if(text[i] === 'K');
{
for (j = i; j < (myName.length + i); j++)
{
hits.push(text[j]);
}
}
}


#5

Hi this part remove the ; after the if condition

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

#6

This is the right code...

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