I need help in "Your second for loop" quick!


This code is really tough for me and I have tried everything and I don't know what to do


When I run my code, it won't work. It says, "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." I have made sure that my name appears in the text variable, but nothing seems to work. I have tried everything, please help.:disappointed:

/*jshint multistr:true */
var text = "Dim sum with Ally";
var myName = "Ally";
var hits = [];
for(var i = 0; i < myName.length; i++){
if (text[0] === "A") {
  for(var j = i; j <i + myName.length; i++){


What about changing your

in the 2nd FOR-loop


That one didn't work, but thanks for trying to help!


You also try to take a character from =myName= should that be =text= ???


Thank you, that helped me solve my code!:grin:


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