Hi please help me fix this code. it is not bahaving as it should. what have I missed? This loop will make sure each character of my name gets pushed to the final array.
Code:
var text= "jospaht jospaht jospaht \ jospaht jospaht jospaht jospaht jospaht\ jospaht jospaht jospaht";
var myName = "jospaht";
var hits= [];
for( var i=0;i<text.length;i++){
}
if(text[i]==="j"){
for(var i=0;i<i+myName.length;i++){
hits.push("jospaht");
}
}
Comment