Your Second for loop


I really don't know what's wrong with this code. I'm kind of stuck.
I keep getting this error sayin

"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."

var text = "Hey how are you doing? \
            My name is Kate.";

var myName = "Kate";

var hits = [];

for(var i = 0; i > text.length; i++){
    if(text[i] == "K"){
        for(var j = i; j < (myName.length + i); j++){


the problem is actually in your first for loop

the first for loop condition is false (from the beginning) so your first loop never runs



i > text.length ?


thanks for that, I totally missed that. Cause it let me pass through my first loop. Thanks for the fast reply :slight_smile:


Thanks for that, Totally missed that.


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