5/7 confusing error


#1

I'm having trouble with this error: Unexpected token for
What am I doing wrong?
here'e what I wrote:
/*jshint multistr:true */
var text = "Hey there";
var myName = "Dylan";
var hits = [];

for(var i=0; i < text.length; i++) {
if (text[i] === "D") {
console.log("Dylan")
for(var j = 0; // rest of loop setup)

for(var j - i; // rest of loop setup)

}
}


#2

var text = "Hey there";
var myName = "Dylan";
var hits = [];

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

I hope it would be helpful for you!


#3

@teresa860712,
With

 var text = "Hey there";

and the IF-condition

text[i] === "D"

she will never have a hit !!!!!


#4

@leonhard.wettengmx.n
Yes! You're right!!!! I don't notice that.

The text should be
var text = "Hey there, I'm Dylan."

Then, there would be a hit!!

Thanks for your notification:)


#5

Now the error says that I'm missing my 2nd "for"
Now What!?


#6

refresh that, now it says that my 2nd "for" isn't pushing the hits array


#7

I've now got it to work
However this coding bug allowed me to skip the rest of the coding.
I have no idea why.....