Lesson 6 Code error Help! SOLVED


#1



 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.

My code:
/*jshint multistr:true */
var text = "BLA BLA BLA /BLABLABLAB ABLLABLABLBALABLABL BALLBALBA LABLAL AB L ABL B LAL B ABL ABL ABA LVL VLB L NATHANIEL BLAABLA LABLBALBALABLBALBALLABLABLAB NATHANIEL BLA "

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


#2

if you want this to work, your if statement + second for loop should be inside your first loop, otherwise the if statement will never be true