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


#1

var text ="Hey, how are you \
doing? My name is Hasnol.";
 var myName =" Ahmad HasnolHisham Bin Kamarudin";
 var hits= [];
 for( var i=0; i<text.length;i++)
 {
     if(text[i]=== "A")
     {
        for( var j=i; j<(i+myName.length); j++)
        {
          hits.push(text[j]);
            
        }
     }
 }

#2

You need to replace Hasnol with Ahmad

You need to have the same name


#3

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