5. Your second "for" loop Hits array error. Debug pls


#1

Hi, i m getting this error "It looks like your second 'for' loop isn't pushing values to the hits array. " And cant found the error, can someone help me pls :slight_smile:

/*jshint multistr:true */

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

var myName = "Jose";

var hits = [];

for(var i=0; i > text.length; i++){
    if(text[i] === "J"){
       for(var q = i; q < myName.length + i; q++) {
		    hits.push(text[q]);
		} 
    }
}.

Thanks for ur time.


#2

Did you mean i<text.length?


#3

omg that was my mistake, i didnt see that error.

Thanks biff! now i can continue with this.


#4

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