Will not let me submit code, error page


#1

Hi, I am having a serious problem passing this page, everytime i click submit it kind of freezes and then crashes and comes up with an error message...i have checked and this is the only site it is doing this for, and i would really like to keep going but i cant verify whether my code is right or not :pensive:


#2

Hi,

Do you have any loops in your code as it sounds like an infinite loop.
Check your code :slight_smile:
paste in your code and we can have a look.


#3

Okay thanks, here is my code:

var text = "Hi, I am Mafe and i like it when Mafe makes \
muffins", myName = "Mafe", hits = [];
for (var i= 0; i< text.length; i++) {
    if(text[i] === myName[0]) {
        for( var j= i; j= myName.length; j++) {
            hits.push("Mafe");
            hits[0];
        }
    }
};

https://www.codecademy.com/courses/javascript-beginner-en-XEDZA/0/5


#4

have a look at this line properly

Hint:
Your loop should stop when it hits the value of the first iterator (say, i) plus the length of your myName variable.