Won't Push Text


#1



https://www.codecademy.com/courses/javascript-beginner-en-XEDZA/0/5?curriculum_id=506324b3a7dffd00020bf661#


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 = "BEEDO BEEDO BEEDO BOBONA. I see a potato here, BOBONA!! BOBONA is an emotian now!!";
var myName = "BOBONA";
var hits = []

for (var i = 0; i <= text.length; i++) {
    if(text[i] === myName[1]) {
        for (var b = i; b >= b + myName.length; b++) {
            hits.push(text[b])
        }
    }
}


#2

HI this line

if(text[i] === myName[1])

with myName[1] you select the second letter instead if the first letter of your name so you should put myName[0] then in the second for loop

for (var b = i; b >= b + myName.length; b++)

this part

b >= b + myName.length

you should change the >= with <= then instead of b + myName.length you should put i + myName.length