5/7 I don't know why my code isn't working (second for loop)


#1



/*jshint multistr:true */
var text = 'Hey, my name is Bridget!'
var myName = 'Bridget'
var hits = []

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


#2

Hi, this line

if (text[0] === 'B')

why did you put text[0]? in this case it will only check for the first letter in the string instead 0 you should put i


#3

Thank you!! It's working fine now