Unexpected Token }



My code pops up with the error SyntaxError: Unexpected token }

var text= "I love corgi's my name is Tayler. But I love Corigs more then Phillip does Tayler";
var myName="Tayler";
var hits=[];
/*jshint multistr:true */

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


your code should look like

for(var i=0; i<=text.length; i++){ //opening bracket for for-loop
  if(text[0]==="T"){            //opening bracket for if
    for(var j=i; j<i+myName.length; j++){ // opening bracket for for-loop
} //closing bracket for second for-loop
} //closing bracket for if
} //closing bracket for first for-loop

read my comment


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