Second Loop Syntax


#1


Lesson 5: Your second "for" loop

I'm simply not getting the syntax right. Very lost on this one.


var text = "Here is some text for Kevin \ There is just so much going on.";
var myName = "Kevin";
var hits = [5];

for (var i = 0; i < text.length; i++){
        console.log (i);
    if (text[i] === "K") {
        console.log (text);
    for (var j = i; i < text.length; i++){
        newArray = [5];
        newArray.push("Kevin");
        newArray[1];
    }
    
};


#2

You don't need a number in between the brackets
and you also don't need the console.logs in between.

you also need instead of what you have but you need j < i + myName.length

and get rid of all of these and change them to
hits.push("Kevin");

Hope that helped you