>>
I'm looking at it but I cant quite figure out why or what this does. at first I thought it was looking for every occurance of myName, but that doesnt seem to be the case, it just looks like it finds every occurance of J and then pushes the next characters the length of myname.
its a bit confusing.
anyways, what happens here is the reason it takes myName.length + i is because its using that as an index of where to seek the string "text", if you had just done myName.length it would never be able to complete past the length of myName because the "i" variable would be passed the length.
essentially, it could be written the same way as
for (var j = 0; j < myName.length); j++)
{
hits.push(text[j+i]);
}
indeed, that may even be a bit more concise, as it explains that its pushing the text at the index of j + i.
there is a major problem with this, though. if the string has less characters at the end of the string that exists in myName, your program will crash, as the index of the string will be out of bounds.
so, it might be safer to say
Message too long. Click here to view the full text.