3.7 Passed but - Returns too many of my name


Hi all,

I'm trying to figure out why my name shows up so many times in the array. Is it because I used i++ and j++? What else would I have used instead?


/*jshint multistr:true */

var text = "May likes to climb, May likes to ski\
May likes to dance...and other stuff too";

var myName = "May";

var hits = [];

for (i = 0; i < text.length; i++ ){
if (text[i] === "M") {
for (var j = i; j < i + myName.length; j++){

if (hits.length ===0){
console.log("Your name wasn't found!")
} else {


[ 'May', 'May', 'May', 'May', 'May', 'May', 'May', 'May', 'May' ]


Hi try to change in hits.push("May"); May by text[j] like that hits.push(text[j]);


Thank you that was it!