Search Text for you name 5. "Your second for loop" HELP!


Error Message: "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 keep getting this error message but don't understand exactly what I did wrong. Can anyone help debug my code?

/*jshint multistr:true */
var text = "Food food food food food food food billy \
food food food food blah blah blah food fod billy food \
food billy food";
var myName = "Billy";
var hits = [];

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


JavaScript is case-sensitive. Use the proper name in your text string.


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