5. your second for loop


#1

`/*jshint multistr:true */

var text = "Emily is cool";
var myName = "Emily";
var hits=[]
for(var i = 0; i < text.length; i++){
if (text[i] === 'E')
{
for(var j = 0; j < myName.length; j++){
hits.push(text('Emily'))
}
}`
}

I can't even find whats wrong i've looked all over and still can't fins whats wrong with the code can someone help?


#2

One thing is he second for loop needs to stop once it has reached the index of the letter in the text PLUS the length of myName. Not only the length of myName.
for(j = 0; j < i + myName.length; j++) {


#3

You have a typo. Look at the ` after the second last "}". You may have other issues but that's one of them.


#4

Hi this part

hits.push(text('Emily'))

You should push inside hits text[j] like that

hits.push(text[j])