SyntaxError: Invalid or unexpected token


5. Your second for loop

Not getting an output despite looking and copying answers in forum. Please help find the error in this code.

var text = "Hey brother, I heard you stole my gears from George. Give them back to George you criminal.";

var myName = "George";
var hits = [];

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




you got a . after the semi-colon, why?


That was from the template not there in my code. Still doesnt work


I have sorted - there was nothing wrong must have been the browser


yea, it was the only thing wrong i could find. Good you sorted it :slight_smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.