Lesson 6 log it



There's a problem with my stynax and I can't seem to find it

var text = "Hey what's up Shae \ How are you Shae?";
var myName = "Shae"
var hits = []
for(var i = 0 ;i > text.length ; i++); {
 if (text[5] === "S" );{
 if(text [5] === "h"); 
    { for (j = i; j< i + myName.length; j++);

if(hits.length === 0); {
    console.log("Your name wasn't found");


after a if statement and a for loop there shouldn't be semi-colons:

if (condition) // no semi-colon {
for (start; stop; step) // no semi-colon {

also, in your first for loop you use >, it should be <, you want i to increase until it is greater then text length (this way it can loop over the entire text)


why do you have this twice:

if (text[5] === "S" )

also, it should be text[i] since i is what you use to loop over the string stored in the text variable.

oh and then this line:


you should push text[j] int your hits array, given the second for loop is what you use to push all instances/letters of your name into the hits array


Thank you so much I was so consummed of trying not to miss any semi-colon's cause i usally do that I overlooked the fact that there is no semi-colon after the if (condition). Thank you so so much