6. Log it - Not printing correctly


#1



I've followed all the instruction exactly and it's not printing my name...at all. Also, ignore the misspell of "corporation" lol.

https://www.codecademy.com/en/courses/javascript-beginner-en-XEDZA/0/6?curriculum_id=506324b3a7dffd00020bf661#


[ 'C', ' ', ' ', '.' ]

var text = "Chris Jill Claire Wesker Barry Zombie Hunter Jimmy \
Resident Evil Random Jimmy Trains Mansion Umbrella Corparation \
Jimmy.";

var myName = "Jimmy"

var hits = []

for (i = 0; i <= text.length; i++){
    if (text[i] === "J"){
       for(var a = i; a < (myName.length + i); a++); {
           hits.push(text[a]);
       }
    }
}
if (hits.length === 0) {
    console.log("Your name wasn't found!");
    }
    else {
        console.log(hits);
    }




#2

for(var a = i; a < (myName.length + i); a++); <- this semi-colon

see code, the semi-colon you put ther,e will prevent the second for loop from running properly.


#3

oh man...I have no idea why I put that there...it was driving me crazy aha, thanks a lot!