JavaScript Log it!


#1

Hello there.
I get the "SyntaxError: Unexpected token . " error whenever I run my code. Here it is:

/*jshint multistr:true*/ 

var text = "blah blah blah blah Lawrence blah blah bah \
blah bah lbah blah blah blah blah blah blah Lawrence \
 blah bah blah blah blaha blah";

var myName = "Lawrence";

var hits = [];

for (var i = 0; i < text.length; i++) {
    if (text[i] === 'L') {
        for (var j = i; j < i+ (myName.length); {
           
             hits.push(text[j]);
        }
      
    }
}
if (hits.length === 0) {
    console.log ("Your name wasn't found!"); 
}
else {
    console.log (hits);
}

what could be the problem? thanks in advance!


#2

This for loop is the problem have a look at what you did for the previous one.
PS: And read this to learn how to make your code look readable: