Unexpected token <


Hello everyone,

I have been trying for the past half hour to get this to work but it keeps giving me this 'SyntaxError: unexpected token <' error...
I don't understand why it doesn't work, please help me.

/*jshint multistr:true */
var text = "Hey, how are you doing? \
My name is Wannes. I hope you are doing well? \
Would you like your name to be Wannes?";
var myName = "Wannes";
var hits = [];

for(var i = 0; i < text.length; i++) {
    if( text[0] === "W") {
        for (var j = i, j < i + myName.length, j++) {


your second for loop, you decided to use comma's (,) to separate the initialization, condition and final-expression, this should be semi-colons (;)

MDN - for loop


Thanks a lot, i didn't notice that!

But after I changed the comma's to semi-colons, it still didn't work.
This time it seems like my second 'for' loop isn't pushing values to my 'hits' array...

'Oops, try again. It looks like your second 'for' loop isn't pushing values to the hits array. Make sure it's working properly and that myName's text appears somewhere in the text variable.'



if( text[0] === "W")

you have the first loop to loop over text, so you want to check if text[i] equals the first letter of your name


Ohhhh, right!

Thank you so much, now i got it right!