What is the problem?>


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

```

Replace this line with your code.
var text= " Manal Manal Manal ";
var myName = “Manal”;
var hits=;
for( i=0 ;i<text.length ;i++){
if(text[i] === ‘M’){
for ( j=i; j< myname.length+i ;j++){
hits.push(text’j’);
}
}
}
console.log(hits);

<do not remove the three backticks above>

#2

Hi you should .push() inside hits text[j]


#3

it is not the problem i write it and i get this massege
Oops, try again. Careful: your second ‘for’ loop should stop when it reaches its current point in the string + myName.length.


#4

can you post your new code?


#5

sure

var text= " Manal Manal Manal ";
var myName = “Manal”;
var hits=;
for( i=0 ;i<text.length ;i++){
if(text[i] === ‘M’){
for ( j=i; j< myname.length+i ;j++){
hits.push(text[j]);
}
}
}
console.log(hits);


#6

This part

for ( j=i; j< myname.length+i ;j++)

you should change myname.length with myName.length


#7

Thank you :relaxed: