6. Can't get what's wrong


#1

/*jshint multistr:true */

text="Julia has a fox which was  named Julia which has a toy called  Julia";
var myName= "Julia";
var hits= [];

for(var i=0; i<=text.length; i++){
    if(text[i] === "J"){
        console.log("Hello!");
       for(var j=1; j<(myName.length+i); j++){
            hits.push(text[j])
        }
    }
}
if(hits.length === 0){
    console.log("Your name wasn't found!");
}else{
    console.log(hits);
}

In console I only see this: "TypeError: console.log is not a function" Where is a mistake?


#2

Hi in your for loop you put j=1 instead of j=i


#3

Hello,thanks! I fixed it, but the problem is still here.
Upd. everything is fine, thanks again! :slightly_smiling: