5/7 Whats wrong?

/*jshint multistr:true */
var text="jandj Kaspars asdjnaskd asdbasd asdjnadjand \
aksdmlkasd asdaslkd asdkasd asdkmaskldmasd akls \
asdkasldk Kaspars asdn asjdnas adhbasd ashd ha sdhb Kaspars";
var myName="Kaspars";
var hits= [];

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

It would be great if someone could help me! Dont get whats is wrong, but it keeps saying :
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.


First of all, I think you should replace the "E" in your if statement to a "K", for there is no "E" in your name. AND, do


so it prints it.


Oh, thanks! Did that, but still, nothing. The same error.


/*jshint multistr:true */

var text = "Don, yo Don yo Don yo Don";
var myName = "Don";
var hits = [];

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



It won't work says the same message as the person above


Hey donovans! You got the wrong comparator:

Instead of

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

You put

See the ">" sign? That makes it already true, so it does not function.

Hope it helped!:smiley:

P.S. @byteblaster33754! I believe you have the same problem there.


THANK YOU SO MUCH... You have no idea how long I agonized over this.


You've written the first loop wrong. You need the "<" sign, not ">".


OMG, thank you so much! :smile: