Help!


#1

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


#2

This is a common error. There should be no semi-colon in there.


#3

Your solution didn't help in general, but thanks for helping me as I missed that.

Here is my current code, I have no idea whats wrong:

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

console.log(hits);


#4

I see what I did wrong!

I had no "J" in the first place!


#5

Good catch!

For future reference, please see this page concerning code sample posting...

Using backticks to format your code - Meta - Codecademy Discuss


#6

Well, thank you for your help.