How to solve this: Log it!


#1

/*jshint multistr:true */
/*jshint multistr:true */
var text="Hello Davis! How was everything going, Davis?"
var myName="Davis"
var hits=[]
for(var i=0; iif(text[i]==='D'){
for(var j=i; jhits.push(text[j]);
}
}
}


#2

Hi it should look like that...

   for(var i = 0; i < text.length; i++) { //go through text up to and including the last character, so I put <=
    if (text[i] === "D") {
    for (var j = i; i < (myName.length + 1); j++) { //if i==="D", so j too, push characters up to and including last character of myName to hits
    hits.push(text[j]);
    } 
    }
    }