5/7 Second "For" Loop


#1

Not sure what I did wrong, help is greatly appreciated!
/*jshint multistr:true */
var text = "Reality is an illusion";
var myName = "Allison";
var hits = [];
for ( var i = 0; i < text.length; i++);
if (text[i] === myName[0]) {
for (var j = i; j < (i + myName.length); j++) {
hits.push(text[j]);
}
};


#2

Hey @deviantambivert,

Loops like the for loop have one thing they should have and what they shouldn't have.

What they should have:

  • Every loop must have two corresponding brackets

Example:

However, what they shouldn't have:

  • A semi colon before the first corresponding bracket, but after the loop.

Example:

Hope it helped!:smiley: