There's an error regarding my phrasing on line 8


I'm not sure why I can't add i to myName.length since i represents the starting point. But I'm getting an error so it must be my phrasing.


What errors are you getting?

I think the problem is line 6, you misspelled length....

Next time copy and paste your code rather then doing a screenshot.


I fixed that spelling error and I wrote myName.length + i on line 8, but the browser crashes when I run the code. I think there's still something off with line 8 since that's supposed to end my loop.
var myName = "Mohammed"
var hits = [ ]
for ( var i = 0; i < text.length; i++)
if(text[i] === 'M') {
for(var j = i; j < (i + myName.length); hits.push('Mohammed'));


Hi here

for(var j = i; j < (i + myName.length);

You forgot to add j++ inside it like that

for(var j = i; j < (i + myName.length); j++)

And also inside your hits.push you should put text[j] like that