Loop won't push values to hits array


/*jshint multistr:true */
var text = "Mother birds feeding their young says Mandy. \ There's beauty in what we believe he said, open your eyes Mandy.";
var myName ="Mandy";
var hits = [];

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

I don't fully understand how to use .push() and I believe that what I am inputting in the array is the problem. Will someone please explain?


Your first FOR-loop definition is a mess...
Have a read

In the first for-loop you are running over the text
‚ó¶character by character using text[i] as character-value, as long as text.length
‚ó¶comparing it to "M" in a IF-statement

Then further on you are using the push() Method
google search
google search
javascript push array site:developer.mozilla.org
(also look in left-hand collumn Methods.... )

javascript push array site:stackoverflow.com