Need help


Oops, try again. There was a problem with your syntax. and SyntaxError: Unexpected token , and Expected ')' to match with '(' from line 7 and instead saw ';'.
Expected an identifier and instead saw ')'.

/*jshint multistr:true */
var text = "hello there Gary, My name is Gary. What is your nameGary?Is it Gary, or Gary?I like the name Gary.Blah blah Gary, Gary, Gary.I like chicken Gary.Do you like it too Gary?";
var myName = "Gary";
var hits = [];
for(var i =0;i < text.length;i+=1){
    if(text[i] ==='G'){
        for(var j = i;j < myName.length + i;j++;);{


Your second for is slightly wrong. You need to add set of parenthesis to the myName.length + i. Your finished if should look like this.

for(var j = i; j < (myName.length + i); j++) {

If that was solved your code please mark my reply as the solution. :slight_smile:


its good now.thanks for helping!


Your most certainlyy welcome. Can you please mark my reply as the solution?


how do you mark your reply as the solution?:confused:


Under my first response to the left of the reply button there are 3 dots, click that then click the mark as solution button.


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