.5 The second for loop HELP


#1



Error message states: 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 = "Hey, how are you \
doing? My name is Kyle. Kyle enjoys coding, but more importently, Kyle likes talking in third person.";
var myName = "Kyle";
var hits = [];

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


#2

Firstly you are using unnecessary semi-colons after your for loops.

Here you have made a for loop with the variable j but you haven't actually used it. You need to make this [i] into [j].


#3

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