6/7; what is wrong with my code?


var text="Become a programmer,Shah\
Become a programmer, Shah\
Become a programmer!";
var myName= "Shah"
var hits=[];
for(var i =0; i < text.length; i++);
if(text[i] === 'S')
for(var j =i; j<(myName.length+i); j++);
if(hits.length ===0){
console.log("Your name wasn't found!");
else {

//It says there's a TypeError but I don't know what the error is.


You missed your bracket here:

You also need to take out the semi colon after your loop, for NO semi colons should be BEFORE your starting brackets. Take the bracket that does nothing out(bolded one):

Here also:


Are you sure you're supposed to just push "Shah"?

Then what's the use of this?

If I remember correctly, I believe that you're supposed to push j, not just "Shah".

P.S. When you tell to push "j", you have to tell the location. I believe the location is in text... or maybe something else :smiley: