Your second "for" loop


Second for loop isn't pushing values to the array. Can't seem to identify the problem.

var text = "Hey it's your boy Minki. \ How you doing Minki? \ Minki is so cool. \ Minki is going to be great.";
var myName = "Minki";
var hits = [];

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



if (text[i] === "M")

also don't put a semi colon after your for conditional. Semi colon's never go after stuff like that.

Doing if (text[i] === myName[0]) doesn't work because the text in myName is not the same as in text. So using an index to find the first letter of your name won't work.

if(text[18] === myName[0]) doesn't work because it's grabbing the index number, not the value of it which is "M", from what I understand anyway.


awesome thanks so much!


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