Stuck on searching text for your name (lesson 6)


#1


Hello, so I have been stuck on this particular lesson for a while and I figured, after a long time of trying, that I was going to need some help. I did everything I should yet I can't find any syntax errors. Any help is appreciated


Oops, try again. It looks like your second 'for' loop isn't pushing values to the hits array. Make sure it's working properly and that myName's text appears somewhere in the text variable.


/*jshint multistr:true */
var text = "texxt text tezt text stuff text max text"
var myName = "max"
var hits = []
for (i = 0; i < text.length; i++) {console.log("i= " + i)} 
if(text[i] === 'M') {for (j = i;j <myName.length +i; j++)  {hits.push[j]; console.log("j= " + j) }     }


#2

your if condition:

if(text[i] === 'M')

string comparison is case sensitive. there is no M in the string stored in text


#3

Oh well I'm dumb. Thanks!! Have a nice day/evening. (Happy holidays too I guess idk)


#4