I'm new to JavaScript and ran into an issue with the code below, trying to find the string "Craig" and add it to a new array called "Hits".
var text = "Hey, how are you \ doing? My name is Emily.\ My other friends name is Craig. My friend Craig is learning JavaScript";
var myName = "Craig"
var hits = [];
for(var i = 0; i < text.length; i++){
if(text[i]=== "C"){
for(var j = i; j < myName.length; j++ ){
hits.push(j);
}
}
}