SyntaxError: Unexpected token )


#1

When I press save and submit, the error message comes up saying
> Oops, try again. There was a problem with your syntax.
and the preview screen says:
> SyntaxError: Unexpected token )
My code is:

/*jshint multistr:true */
var text = "blah blah blah blah blah blah blah/ blah blah my name is Stealthtail101";
var myName = "Stealthtail101";
var hits = [];
for(var i = 0; i < text.length; i++) {
if(text[i] === 'S') {
for(var j = i; j < (myName.length + i);
j++) {
hits.push(text[j]);
}
}
}
if(/*hits.length is 0*/) {
console.log("We can not find your name...")
} else {
console.log(hits);
}
The code has worked up until the last excersice... anyone know what is wrong with it?


#2

Hi you put that if statement as coment if(/*hits.length is 0*/) and it should be like that if(hits.length === 0)


#3

Thanks for your help :slightly_smiling: