I don't understand what to do? Lost :(


I have somewhat idea of what I'm doing but I'm still stuck to what's happening here???
I did my bit of coding and looked around the forum if I was doing something wrong...
Error message:
'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.'

This is how my code looks: 
var text = "blah blah blah blah blah Nikhil, blah blah blah blah blah blah Nikhil, blah blah blah blah blah Nikhil";
var myName = "Nikhil";
var hits = [];
for (i=0; i===text.length; i++){
    if(text[i] === myName[0]){
        for (j=i; j < (i+myName.length); j++){


Hi this line

for (i=0; i===text.length; i++)

this part


you should change === with < because i will never be equal to text.length


Worked like a charm! Thanks A Lot!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.