Whats wrong with this please


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.

/*jshint multistr:true */
var text  = "Hi there how are you";
var myName = "Zico";
var hits = [];

for (var i = 0 ; i < text.length ; i++)
    (text[i] === "Z")
        for (var j = i; j < (myName.length + i); j++)


Just kidding, I lied, but your code looks good except for messy. Let me take a closer look.


i recieved this error message after making this change

Oops, try again. Careful: your second 'for' loop should stop when it reaches its current point in the string + myName.length.


I'm dumb, your code is fine, you just need to make sure that your name is in the text, for example, "Hi there how are you, Zico"
Text needs to be equal to a string with your name in it.


of course! thanks!!!


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