6/7 object does not support property method or 'log' - Solved


#1

Hello,

Would really appreciate some help, I'm getting the error message as listed in the title. I can't see my mistake, here's my code:

/*jshint multistr:true */

var text = "My name is Mike, Mike, Hike, Mike"
var myName ="Mike"
hits = []
for(var i=0;i<text.length; i++){
if (text[i] === 'M'){for(var j = i; j <(myName.length+i); j++)
{hits.push(text[j]); }
}
}
if(hits.length === 0){
console.log("Your name wasn't found!");
} else {
console.log(hits);
}

Hope you can help!

Mike


#2

You code looks fine to me. It may be your browser. Codecademy hasn't been working well with chrome recently, maybe try using a different browser like Firefox.

Please say if that solved it or if you are still getting the error.


#3

Hi Oscar,

It was the browser (Microsoft edge), tried it with Safari and no problems. Thanks for your help.

Regards,

Mike


#4

Yay great! Can you please mark my reply as the solution to help others when they get this problem.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.