6/7; what is wrong with my code?


#1

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')
console.log="okay";
}
{
for(var j =i; j<(myName.length+i); j++);
}
{
hits.push("Shah");
}
if(hits.length ===0){
console.log("Your name wasn't found!");
}
else {
console.log(hits);
}

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


#2

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:

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: