5/7 second for loop helpppppp


#1

var text = "How are you today"
var myName = "James"
var hits = []
for (var i = 0; i < text.length; i++){
}
if (text[i] === "J"){
}
for (var j = i; j < (myName.length + i) j++) {
}
hits.push(text[j]){
}
Dont know what i did wrong help


#2

Honestly, I'm not even deep diving into your code, because the very first thing that's wrong is that you haven't included your name in the text variable. Think about it this way: The name of the lesson is "search text for your name". So you need to have your name in that text variable at least once or twice in order for it to be searched, right?

Change your var text to have your name in there at least once or twice, then try again. If you get an error at that point, post the code and error and we can re-evaluate.